By Cameron Newham, Bill Rosenblatt
Cover | Table of Contents | Colophon
sort -n phonelist > phonelist.sorted
| Character | Meaning | See Chapter |
|---|---|---|
| ~ | Home directory | 1 |
| ` | Command substitution (archaic) | 4 |
| # | Comment | 4 |
| $ | Variable expression | 3 |
| & | Background job | 1 |
| * | String wildcard | 1 |
| ( | Start subshell | 8 |
| ) | End subshell | 8 |
| \ | Quote next character | 1 |
| | | Pipe | 1 |
| [ | Start character-set wildcard | 1 |
| ] | End character-set wildcard | 1 |
| { | Start command block | 7 |
| } | End command block | 7 |
| ; | Shell command separator | 3 |
| ' | Strong quote | 1 |
| <"> | Weak quote | 1 |
$ help cd
cd: cd [-PL] [dir]
Change the current directory to DIR. The variable $HOME is the
default DIR. The variable $CDPATH defines the search path for
the directory containing DIR. Alternative directory names in
CDPATH are separated by a colon (:). A null directory name is
the same as the current directory, i.e. `.'. If DIR begins with
a slash (/), then $CDPATH is not used. If the directory is not
found, and the shell option `cdable_vars' is set, then try the
word as a variable name. If that variable has a value, then cd
to the value of that variable. The -P option says to use the
physical directory structure instead of following symbolic links;
the -L option forces symbolic links to be followed.
$ set -o emacs
$ set -o vi
| Command | Description |
| CTRL-B | Move backward one character (without deleting) |
| CTRL-F | Move forward one character |
| DEL | Delete one character backward |
| CTRL-D | Delete one character forward |
| Command | Description |
| DEL | Delete previous character |
| CTRL-W | Erase previous word (i.e., erase until a blank) |
| CTRL-V | Quote the next character |
| ESC | Enter control mode (see below) |
ls -l
more myfile
vi myfile
wc -l myfile
pr myfile | lp -h
1 ls -l 2 more myfile 3 vi myfile 4 wc -l myfile 5 pr myfile | lp -h
| Command | Description |
|---|---|
| ! | Start a history substitution |
| !! | Refers to the last command |
| ! n | Refers to command line n |
| !- n | Refers to the current command line minus n |
| ! string | Refers to the most recent command starting with string |
| !? string? |
Refers to the most recent command containing string. The ending ?
is optional
|
| ^ string1^string2 |
Repeat the last command, replacing string1 with string2
|
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin SHELL=/bin/bash MANPATH=/usr/man:/usr/X11/man EDITOR=/usr/bin/vi PS1='\h:\w\$ ' PS2='> ' export EDITOR
source .bash_profile
alias name=command
alias search=grep
$ search Fred phonelist
alias emcas=emacs alias mali=mail alias gerp=grep
| Option | Description |
|---|---|
| emacs |
Enter emacs editing mode (on by default)
|
| ignoreeof |
Don't allow use of a single CTRL-D to log off; use the exit
command to log off immediately. This has the same effect as setting
the shell variable IGNOREEOF=10. |
varname=value
$ echo "$wonderland"
$ echo "The value of \$ varname is \"$ varname \"."