Command |
Explanation |
Usage |
Example |
Ls |
Display the contents of a directory (Files And Directories) |
Usage: ls or ls directory If LS is left blank, the contents in the face-to-face directory are displayed. You can add the directory path to be viewed after ls. |
Ls Ls/ Ls/home/ Ls/etc/sysconf |
Ls-l |
Detailed display |
Usage: ls-l or LS-l directory Note: L is a letter, not a number 1. |
Ls-l Ls-L/home |
Ls- |
Show all files |
Usage: ls-A or LS-a directory The file starting with "." is a hidden file, which is also displayed. Otherwise, it is not displayed. |
Ls- Ls-La/etc/ |
CP |
Copy a file |
Usage: CP source file target file Note: you can add a path name to the file. |
CP/home/lion/test1/home/lion/test/Test2 |
CP-R |
Copy the entire directory |
Usage: target directory of the original CP-r directory Note: All files in the directory will be copied. |
CP/home/lion/mjli/home/lion/test/mjli2 |
MV |
Move a file or directory |
Similar to CP, but the original file or directory does not exist after moving. Note: The-R parameter is not used to move a directory. |
MV/home/lion/test1/home/lion/Test2 MV/home/lion/mjli/home/lion/mjli2 |
Touch |
Create a file |
Usage: Touch file name |
Touch/home/lion/test1 |
Mkdir |
Create directory |
Usage: mkdir directory name |
Touch/home/lion/mjli |
Rm |
Delete an object |
Usage: RM file name |
Rm/home/lion/test1 |
Rm-R |
Delete directory |
Usage: Rm-r directory name |
Rm-r/home/lion/mjli2 |
Rmdir |
Delete an empty directory |
Usage: rmdir directory name Note: This directory must be empty; otherwise, it cannot be deleted. |
Rmdir/home/lion/mjli2 |
CD |
Change directory path |
Usage: CD directory name |
CD/etc CD/home/lion |
CD .. |
To the directory on the previous Layer |
Usage: CD .. |
CD .. |
CD/ |
To the root directory |
Usage: CD/ |
CD/ |
PWD |
Display the current directory path |
Usage: pwd |
PWD |
Cat |
View File Content |
Usage: CAT file name |
CAT/home/lion/test1 |
More |
View files with long Content |
Usage: more file name Note: More can be used with other commands, such as LS-L | more Note: In the display, Press the Space key to scroll one page, press the Enter key to scroll one line, and press the Q key to exit |
Ls-L | more More/home/lion/Test2 |
Less |
View files with long Content |
Similar to more. In the display, Press Y to scroll up a row |
Less/home/lion/Test2 |
PS aux |
View System Processes |
Note: It is best to use the aux parameter together. |
PS aux |
Kill-9 |
Kill Process |
Usage: Kill-9 PID Note: PID (process ID) can be obtained by the PS aux command |
Kill-9 1231 |
W |
Show online user information |
Usage: W Note: It is more detailed than the WHO command. |
W Who |
Top |
Displays System Task information, including CPU and memory. |
Usage: Top |
Top |
Mesg |
Whether to accept write information from others |
Usage: mesg y or mesg n Note: accept is Y, and N is not accept. |
Mesg y Mesg n |
Write |
Send information to other users |
Usage: write user or write user TTY. Note: tty is used for multiple identical users, which can be obtained by W command. |
Write lion Write lion pts/2 |
Passwd |
Change Password |
Usage: passwd Note: A super user can change the password of another user, which is a passwd user. |
Passwd |
Du |
Displays the disk usage of each file in the directory (including files in subdirectories) |
Usage: du directory name NOTE: If no directory name exists, the current directory is used. |
Du DU/home/lion |
Du-S |
Displays the size of all files in the directory. |
Usage: Du-s directory name NOTE: If no directory name exists, the current directory is used. |
Du-S Du-S/home/lion |
Date |
Display System Date and Time |
Usage: Date |
Date |
Uptime |
Display System running time |
Usage: uptime |
Uptime |
Clear |
Clear current screen |
Usage: Clear |
Clear |
WC |
Statistics file, indicating the number of lines, characters, and characters of the file |
Usage: WC file name |
WC/home/lion/test1 |
Grep |
Filter text |
Used with other commands, such Ls | grep sring indicates that only the rows with strings are displayed. Cat file name | grep string indicates that only the rows with strings in the file are displayed. |
Ls-L | grep string CAT/home/lion | grep hehe PS aux | grep test1 |
Grep-n |
Filter the text and add the row number before the row. |
The user is similar to grep. Just add the parameter. |
Ls-L | grep-N string PS aux | grep-N test1 |
Grep-V |
Filters text and lists rows that do not contain a given string. |
The user is similar to grep. Just add the parameter. |
Ls-L | grep-V string PS aux | grep-V test1 |
Grep string-R |
Search Text |
Usage: grep string-r directory name Search for lines containing strings in all objects in the given directory Note: You can also add the-n-V parameter. |
Grep string-r/ Grep hehe-r/home/lion |
DF |
View system hard disk Information |
Usage: DF |
DF |
Free |
View system memory information |
Usage: free |
Free |
Ping |
Check whether it is connected to the other machine |
Usage: ping the IP address or domain name |
Ping bbs.ustc.edu.cn Ping 202.38.64.1 |
Ifconfig |
View System Nic Information |
Usage: ifconfig Note: common users use/sbin/ifconfig |
Ifconfig Ifconfig | more |
Route |
View System route information |
Usage: Route Note: common users use/sbin/route |
Route |
Echo |
Response content |
Usage: Echo string Note: The result is string. |
Echo hello Echo hehe |
Whoami |
Displays the username currently in operation |
Usage: whoami |
Whoami |
Exit |
Log out of the system |
Usage: Exit |
Exit |
Chmod |
See the following description. |
CTRL + c |
Abort Program Execution |
Usage: Ctrl + c |
CTRL + c |
CTRL + d |
Exit System |
Usage: Ctrl + d |
CTRL + d |
Halt |
Disable computer |
Usage: Halt |
Halt |
Reboot |
Restart the computer |
Usage: reboot |
Reboot |