ctrl+r | Searches for commands you've already typed. When you have entered a very long, complex command and need to repeat it, using this key combination and then typing a portion of the command will search through your command history. When you find it, simply press Enter. | |
History | The history command shows a very long list of commands that you have typed. Each command is displayed next to a number. You can type !x to execute a previously typed command from the list (replace the X with a number). If you history output is too long, then use history | less for a scrollable list. |
ctrl+a or Home | Moves the cursor to the start of a line. | |
ctrl+e or End | Moves the cursor to the end of a line. | |
esc+b | Moves to the beginning of the previous or current word. | |
ctrl+k | Deletes from the current cursor position to the end of the line. | |
ctrl+u | Deletes from the start of the line to the current cursor position. | |
ctrl+w | Deletes the word before the cursor. |
System Information Commands
-
df: The df command displays filesystem disk space usage for all mounted partitions. "df -h" is probably the most useful - it uses megabytes (M) and gigabytes (G) instead of blocks to report. (-h means "human-readable")
-
du: The du command displays the disk usage for a directory. It can either display the space used for all subdirectories or the total for the directory you run it on. Example:
user@users-desktop:~$ du /media/floppy 1032 /media/floppy/files 1036 /media/floppy/ user@users-desktop:~$ du -sh /media/floppy 1.1M /media/floppy/
-
-s means "Summary" and -h means "Human Readable"
-
free: The free command displays the amount of free and used memory in the system. "free -m" will give the information using megabytes, which is probably most useful for current computers.
-
top: The top ('table of processes') command displays information on your Linux system, running processes and system resources, including CPU, RAM & swap usage and total number of tasks being run. To exit top, press "q".
-
uname -a: The uname command with the -a option prints all system information, including machine name, kernel name & version, and a few other details. Most useful for checking which kernel you're using.
-
lsb_release -a: The lsb_release command with the -a option prints version information for the Linux release you're running, for example:
user@computer:~$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 11.10 Release: 11.10 Codename: oneiric
ip addr reports on your system's network interfaces.
&
&命令可用在其他任何命令的后面,它用来通知计算机在后台运行某一命令。通过把作业放在后台,用户可以继续使用当前的shell来处理其他命令;如果命令在前台运行的话,那么用户在此进程结束前不能继续使用当前的shell
grep
grep命令用来在指定的对象中搜索指定的文本。语法是:grep〈text〉〈file〉。它还可以和其他命令的结果联合使用,例如:
ps -ef|grep-v root
这一命令要求grep接受ps命令的输出,并除去所有包含单词root的进程(-v的含义是显示与文本不匹配的内容)。在不使用-v选项时,这一命令将显示进程清单中所有包含单词root的进程。
Linux常见特殊符号