I believe many of the small partners who are ready for Web development and testing want to know about the common commands of Linux.
First of all, I'll show you the commands, a basic impression, and then go on.
Common Commands and explanations
Linux commands |
Command description |
Cd |
Directory switching |
Pwd |
Show current directory path |
Mv |
Move files or directories |
Tar |
Decompression and compression |
Cp |
Copy or cut |
Touch |
Create a file |
Mkdir |
Create a folder |
RmDir |
Delete a folder |
Rm |
Delete |
chmod |
Change permissions |
Cat |
Show file contents |
More |
Pagination Display |
Head |
Show file Header |
Tail |
Show end of File |
Vim |
File editing |
Grep |
Pipeline |
Wc |
Statistics |
Here is a first introduction:
1, the first to play is the CD command, this is the directory Switch command, you need to jump to any directory
Note: Directories under the Linux root directory are: usr, home, etc, bin, dev
For example, I want to switch to home directory CD home or CD ~
Other commands, CD. (to the top level of the directory), CD/(to root), CD. /(to current directory), CD-(returns the previous level in the history)
2, PWD, this command does not introduce more, is used to display the current directory path command
3. Scene Learning
For example: I want to see the first 10 lines of a log file
Command: Head-n My.Log
For example: I want to see the last 10 lines of a file
Command: Tail-n My.Log
For example: I want to see the first 10 lines of "Hello" in the file
Command: cat-n my.log|grep "Hello" |head-n 10
4. The difference between grep and find
Find files by file properties
grep finds related file lines through content
Find-name OK or find/home/my/-name OK (note the location of the directory after the Find command)
grep is commonly used in conjunction with pipelines, but can also be used independently
grep "OK" my.txt find the line containing the OK keyword in the file my.txt
Common commands and scenarios for Linux applications