For users who are unfamiliar with Linux, it is too low to use a command to check an efficiency. And the daily encounter problems reproduce the study is not too small, the summary of several often appearances of the order, take the daily positioning problems, superficial understanding, take to use.
Common shortcut keys
TAB: Command completion/Path completion/file name completion, one tab is complete, two times tab, listing related information.
CTRL + C: Forces the end of the current process. Half did not want to do, want to go back to Ctrl + C.
Ctrl+d: Send an exit signal, we can use this every time we have the meaning of "exit". For example SSH login to another machine, want to quit on Ctrl+d.
CTRL + A: Moves to the beginning of the command.
Ctrl+e: Moves to the end of the command line.
Ctrl+u: Clears the command forward from the current cursor position.
Ctrl+w: Clears a word forward from the current cursor position.
Up and down arrows: up and down to see the command input records, if the history too much to turn up too slow, you can use the historical display and then copy and paste.
File operations
Find Files
The Find command is used to locate the file. For example, you can not remember which directory maven is placed in, you may find it using the following command.
View File Contents
Less page to view the file, followed by the file name to see, the space page down, Q key exit. The less function is very powerful, remember that these two can be used. Example:
Less Error.log
Cat View the entire contents of the file, followed by the file name to see, generally used to look at small files, too large files are used less.
Header to view the first few lines of the file. The corresponding tail is to view the following lines of the file. Tail-f can be used to monitor files and then display them when the files are changed. Example:
Header---------error.log staring at the log file, there are new messages at any time output.
Of course just can see the content sometimes too low, usually with the grep command to filter retrieval. Example:
| grep errorgrep Error Test.log
Copying files
cpcopy files, file copy operations, which can also copy multiple files to a single directory at once. Do not introduce the file move or delete command, in the system operation, less use of MV or RM, before doing backup. Example:
CP Test.log/var/log/test_bak.log
System Monitoring
View Port Usage
See if Port 80 is already open
80
View process
PS (process) to see how the process is running. See, for example, atom-related processes.
PS aux | grep Atom
End Process
Kill-9 PID violence end process. Normally the normal end of the process is the normal end, you can not use the KILL command.
View disk usage
DF shows disk space usage. Get information about how much space the hard drive is taking up and how much space is left.
Du can be specific to the occupation of a folder. The following two commands are commonly used:
DF--ah/dirname View a directory footprint
Linux under Man Help
When a command does not understand the meaning of the man is the most useful help, such as do not know how to use the CP command, the direct man CP can see the detailed explanation.
Also, when you can't remember the specific commands, you can find them by man-k keywords. For example, I do not remember the DF command, but I know disk, so man-k disks, lists a lot of commands, according to the various commands described, almost can be found.
Linux notes: Ready-to-use system operations and problem location commands