|
For Linux, I was a novice, but also the contact began to slowly work with Linux people I would feel Cock Cock, and now the work of some commonly used Linux command record it for future study and reference.
cd
I think this may be one of the easiest Linux command because the windows operating system also applies to the command It is mainly used to change the directory, it can be followed by the absolute path or with a relative path, such as:
cd d: / wjl_hexo ## to the D disk directory wjl_hexo
cd .. ## to the parent directory of the current directory if the current directory is D: / wjl_hexo, after the execution of the current directory is the root directory D
cd ~ ## to the root directory
ls
This command is used to display the file and directory folder information can be followed without parameters, without arguments, it will only display basic information parameter can take more, such as:
-a ## all files, hidden files together (starts. Item) listed together (common)
-l ## in the form of a long string of data listed in the data files and directories in the current directory
-lR ## in the form of a long string of data lists all files in the current directory (think about the reuse)
-t ## chronological
grep
This command is used to search for text, find text information we need, in the format: grep 'keyword' filename, when you view the log with more, may be followed by parameters such as:
grep 'Create Order' filename.log -c ## statistical keyword 'Create Order' in the number of occurrences in filename.log
-i ## Ignore case differences keyword search
-v ## adverse selection, that is, the keyword information to display does not appear
tail
Commonly used in the log viewer for displaying the designated end of the file content, format: tail [parameters] filename, common parameters:
End -f ## dynamic text display, real-time view of the current log output may also be entered directly tailf filename
-n ## display n lines of information, such as: tail -n 5 filename, displays the file last five lines tail -n +5 filename, displays the file start from the fifth row
less
Powerful text view command, you can not modify the contents of the text using the keyboard up down to view the format:.. Less [parameters] filename, such as:
-b ## < buffer size> set the buffer size
-e ## When the file display ends automatically leave
-N ## Display each line number
Input / keyword or? Keyword, keyword information can be retrieved.
Secondary action:
J moved forward line
K to move back one row
g to move to the first row
G moves to the last row
q to exit the less command
ctrl + F to move forward one screen
ctrl + B to move back one screen
ctrl + D to move forward half a screen
ctrl + U to move back half a screen
rm
Command is used to delete one or more files and directories, format: rm [parameters] file / folder, such as:
rm file ## will be prompted whether to delete the file
rm -f file ## forcibly remove the file, the system does not prompt
rm -rf folder ## folder and delete all the contents of the directory without prompting
rm -i * .log ## Delete all .log files, one by one asked to confirm before deleting
rm -r folder ## delete the subdirectory and all subdirectories |
|
|
|