Friday, May 10, 2013
Quick Linux (6): Shell (Overview)
Chapter 5: The Shell
ls -- -l #-- indicates the end of options
PATH = $PATH:. #adds current working directory to the path
s234-155:~ nemo$ who
nemo console May 10 17:55
nemo ttys000 May 10 21:41
$ who #The device name that's displayed after your username is the filename of the screen and keyboard
$echo hello > t.txt #If the file exists, the shell will overwrite it
$echo hello >> t.txt #The append output symbol (>>) appends a file
* The /dev/null device is a data sink, "bit bucket". You can redirect output that you do not want to keep or see to /dev/null
$ who | tee who.out | grep nemo #use tee to redirect output to both a file and standard output
$ jobs
* To run a job in the background use & at the end of a command or bg
* To bring a job back to the foreground: type fg or % followed by the job number
to get the current running jobs type
* To kill a job $kill PID (process number)
[Wildcards]
? #generates filenames that have "tes" followed by a single character
$ ls test.tx?
test.txt
* #matches any number of characters unlike ?
$ ls te*
test.txt
[] #match filenames containing the individual characters, use hyphen for range
s234-155:Linux nemo$ ls
another hello.txt linktest test.txt
s234-155:Linux nemo$ echo [hl]*
hello.txt linktest
s234-155:Linux nemo$ echo [a-f]*
another
special cases: [] with ! and ^
[!a-f]* #means not to include the characters at the beginning
*[^ab] #don't end with those characters
[Builtins]
(to list them $info bash, Shell Builtin Commands)
The shell does not fork a new process when running a builtin.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment