NAME LINE TIME IDLE PID COMMENT
chris tty1 Jan 13 20:57 . 2013
Choosing Your Shell
$ echo $SHELL
Find what is the default shell
Checking Directories and Permissions
$ pwd
$ echo $HOME
$后面的参数为大写
$ cd
Locating Commands
$ echo $PATH
$ type bash
bash is /bin/bash
Checking System Activity
$ ps -au
$ ps -aux | less
Command-Line Recall
$ history 8
Connecting and Expanding Commands
Piping Commands
$ cat /etc/password | sort | less
AS4下,为passwd目录
$ gunzip < /usr/share/man/man1/grep.1.gz | nroff -c -man | less
Sequential Commands
$ date ; troff -me verylargedocument | lpr ; date
Background Commands
$ troff -me verylargedocument | lpr &
Expanding Commands
$ vi $(find /home | grep xyzzy)
Expanding Arithmetic Expressions
$ echo “I am $[2006 - 1957] years old.”
Managing Background and Foreground Processes
$ find /usr > /tmp/allusrfiles &
$ fg %1
$ bg %5
Using Shell Environment Variables
Working with the Linux File System
Files are organized within a hierarchy of directories.
Creating Files and Directories
cd Change to another current working directory.
pwd Print the name of the current working directory.
mkdir Create a directory.
chmod Change the permission on a file or directory.
ls List the contents of a directory.
touch Creates empty files.
Using File-Matching Metacharacters
✦ *—Matches any number of characters.
✦ ?—Matches any one character.
✦ [...]— Matches any one of the characters between the brackets, which can include a dash-separated range of letters or numbers.
Using File-Redirection Metacharacters
✦ <—Directs the contents of a file to the command.
✦ >—Directs the output of a command to a file, deleting the existing file.
✦ >>—Directs the output of a command to a file, adding the output to the end of the existing file.