Jump to content
Sign in to follow this  
Guest anon

Bash stuff

Recommended Posts

Guest anon

Omar Serenity

 

 

Joined: Jan 16, 2002

Posts: 817

From: Somewhere in, MS

Posted: 2002-04-09 20:00 I'm not sure if this happens to everyone or whether or not it only happens while in su mode, but if you kill the shell window with the X at the upper right instead of the exit commands 'exit' to get out of su mode and then 'exit' to exit the shell, the process will still be running in the background, using valuable resources. It does on my machine, anyway. So, do not kill the shell with the X (dismiss) button.

 

_________________

 

 

[ This Message was edited by: Omar Serenity on 2002-04-22 16:40 ]

................................................................................

.............................

Afrosheen

 

 

Joined: Sep 27, 2001

Posts: 2810

From: dallas

Posted: 2002-04-11 11:18 Since we're on the topic of shells...

 

You can also slap tab if you type part of a common command and it'll autocomplete for you or show you what's close to that so you can narrow it down.

................................................................................

........................

tross04401

 

 

Joined: Feb 10, 2002

Posts: 1262

From: Maine (US)

Posted: 2002-04-11 11:25 And a little more... instead of typing "exit" to leave su mode, and then the mouse or "exit" to quit the shell, you can just use <Ctrl>-D, <Ctrl>-D

 

................................................................................

........................

Glitz

user

 

 

Joined: Dec 11, 2001

Posts: 381

From: The Great White North

Posted: 2002-04-11 22:16 Nope, I use shell and if I change to root and then hit the X button the processes are all killed.

 

Glitz.

 

................................................................................

.......................

anon

user

 

 

Joined: Oct 23, 2001

Posts: 369 Posted: 2002-04-11 23:14 And something else i found, if your in a term and keep hitting the up arrow key it displays previous commands you entered.

_________________

Mandrake Club Member

................................................................................

.....................

coccodrilletto

new user

 

 

Joined: Jan 14, 2002

Posts: 48 Posted: 2002-04-18 16:54 The different behavior experiencd by OmarSerenity and Glitz is interesting; maybe they have different security levels set ?

 

................................................................................

......................

syphon detonator

user

 

 

Joined: Jan 18, 2002

Posts: 122

From: totse.com

Posted: 2002-04-18 19:31 its an oldy but a goody huh? my opinion is always use text if you can . x is nice but its no windows gui, its a tool not a crutch.

................................................................................

....................

Glitz

user

 

 

Joined: Dec 11, 2001

Posts: 381

From: The Great White North

Posted: 2002-04-22 16:04

Quote:

 

 

On 2002-04-11 23:14, anon wrote:

And something else i found, if your in a term and keep hitting the up arrow key it displays previous commands you entered.

 

 

 

And the previous commands are saved so that if you exit the terminal, turn off your computer, turn on the computer again, and open the terminal again, you can still get the commands you used in previous sessions.

 

Glitz.

 

 

 

Joined: Aug 31, 2001

Posts: 621

From: Philippines

Posted: 2002-04-22 20:16

an if you are sick of all those commands that you have no more use for, edit your ~/.bash_history file and delete the offending lines. the change will be reflected the next time you start a bash session.

 

additional info: the commands are only saved to the file when you exit a bash session.

 

ciao!

_________________

----

You just read a post from a newbie. Take everything with a grain of salt...

 

................................................................................

................

 

 

Joined: Nov 24, 2001

Posts: 874

From: Spain

Posted: 2002-04-23 04:38 Something else about command history (tips):

 

If you enter "!op [enter]" as follows

~$ !op

the shell will launch the last full command from bash_history that starts with the letters 'op', ie: "opera http//www.mandrakeuser.org/mub/ &"

 

so use the ! character to avoid the up arrow key searching icon_wink.gif

 

Reverse searching:

If you enter ctrl-r and then a string you'll get the last command line entry that contains the string starting at the bottom of the text entry. Example:

~$[ctrl-r] null

you'll get the last command redirected to /dev/null:

~$ grep "ypserv" /etc/*/* 2> /dev/null

 

Have fun with bash (there resides all the power of Linux)

 

_________________

Imagination is a quality given a man to compensate him for what he is not, and a sense of humor was provided to console him for what he is.

O. Wilde

( Just a bit of color ;o)

 

Author Something I've learned about the shell

ramfree17

senior user

 

 

Joined: Aug 31, 2001

Posts: 621

From: Philippines

Posted: 2002-04-23 05:23

Quote:

 

Have fun with bash (there resides all the power of Linux)

 

 

 

oh? i thought it was in the kernel? just messing with you aru...

View Profile of ramfree17 Edit/Delete This Post Reply with quote

arusabal

 

 

Joined: Nov 24, 2001

Posts: 874

From: Spain

Posted: 2002-04-23 08:53 you are right ramfree!

 

...so if the heart of Linux is the Kernel, let me say that bash is the liver of Linux (I'm biochemical, so...) ;o)

_________________

Imagination is a quality given a man to compensate him for what he is not, and a sense of humor was provided to console him for what he is.

O. Wilde

( Just a bit of color ;o)

View Profile of arusabal Edit/Delete This Post Reply with quote

arusabal

 

 

Joined: Nov 24, 2001

Posts: 874

From: Spain

Posted: 2002-04-23 08:57 Just a bit more on shell history stuff icon_wink.gif

 

To show all the commands in your bash_history file type:

~$ history

so you'll get:

1 startx

2 ls

3 arch

4 cat /proc/cpuinfo

5 halt

...

863 mkdir rhat-guia

864 mv rhl-* rhat-guia/

865 cd rhat-guia/

866 tar xvfz rhl-*

867 ls

868 tar xvfz rhl-rg-en-72.tgz

869 tar xvfz rhl-cg-en-72.tgz

 

so if you want to run history event number 4, you'll need to do:

~$ !4

 

and it will show:

processor : 0

vendor_id : GenuineIntel

cpu family : 5

model : 4

model name .......

 

[...PRIVATE DATA // CENSORED...]

 

 

 

I'm a bit shy (it has only 166MHz)

 

 

_________________

Imagination is a quality given a man to compensate him for what he is not, and a sense of humor was provided to console him for what he is.

O. Wilde

( Just a bit of color ;o)

View Profile of arusabal Edit/Delete This Post Reply with quote

CannonFodder

 

 

Joined: Dec 13, 2001

Posts: 929 Posted: 2002-04-23 09:15 You can also work with more than one process in a terminal.

 

Let's say I open a console and type

 

man top

 

Then hit control-z. I return to the shell prompt.

 

Type

 

job

 

and you get a list of jobs running. You will see "Man Top" in there.

 

type fg (foreground) and you will pop the top process back to the foreground.

 

Really more of a use if you are not running X but fun anyways icon_smile.gif

 

 

_________________

"Have you kissed your local Propeller Head today?"

View Profile of CannonFodder Edit/Delete This Post Reply with quote

arusabal

 

 

Joined: Nov 24, 2001

Posts: 874

From: Spain

Posted: 2002-04-23 09:28

Quote:

 

 

On 2002-04-23 09:15, CannonFodder wrote:

 

type fg (foreground) and you will pop the top process back to the foreground.

 

 

 

Even more, if you have several processes running in the back ground and you want to put some in foreground which is not the top process of the list you can do it by adding %[number]. ie: ~$ fg %3 will make that the process number 3 will run on foreground.

 

Else if you have several process stopped (sleeping) you can activate them by typing:

bg %[number], so the process will run in the back ground

 

_________________

Imagination is a quality given a man to compensate him for what he is not, and a sense of humor was provided to console him for what he is.

O. Wilde

( Just a bit of color ;o)

 

[ This Message was edited by: arusabal on 2002-04-23 09:30 ]

View Profile of arusabal Edit/Delete This Post Reply with quote

tross04401

 

 

Joined: Feb 10, 2002

Posts: 1262

From: Maine (US)

Posted: 2002-04-23 09:34

Quote:

 

 

On 2002-04-22 20:16, ramfree17 wrote:

 

an if you are sick of all those commands that you have no more use for, edit your ~/.bash_history file and delete the offending lines. the change will be reflected the next time you start a bash session.

 

additional info: the commands are only saved to the file when you exit a bash session.

 

ciao!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...