Common linux commands
Common commands:
1. view the Directory: ls
Ls-a contains Hidden Directories
Ls-l displays detailed information.-starts with file d and starts with directory
Blue is the Directory
Green: Executable File
Black (white): normal file
2. See help:
Man command name
Q exit
3. view the current directory:
Which directory does pwd look?
4. Enter the Directory
Cd directory name
Absolute directory/
Relative directory. Current directory... parent directory
5. Go to the super directory
Root
Operation file:
1. create directory: mkdir directory name
2. Copy: cp source (absolute or relative) Target (file or directory)
Cp-r source (can be absolute, can be relative) Target (can be a file, can be a directory) if it does not exist, create, if it exists, go to the test
3. Mobile: mv Source Target
Delete a folder instance:
Rm-rf/var/log/httpd/access
The/var/log/httpd/access Directory and all files and folders under it will be deleted.
2
Delete a file instance:
Rm-f/var/log/httpd/access. log
The file/var/log/httpd/access. log will be forcibly deleted.
VI:
1. vi file name open this file with vi (If yes, open it, if no)
2. Write files
Insert the I table above
Insert table a following
3. Click esc to exit the editing mode.
Enter the colon
: W save
: Wq save and exit
: Q! Exit Without saving (Force Exit)
4. esc, undo: u
5. Replacement character: r
6. Copy: copy a row from the 1yy 1 Table
Copy multiple rows: 10yy
Move the cursor to the specified row with the keyboard
Point p
7. paste: p
8. Search: // find the word from front to back n to find the next one
? The word to be searched goes forward from the back
9. Set the row number:
: Set number
10. Remove the row number:
: Set nonumber
11. Go to n rows:
105
12. Write files
Echo "hello, world"> a.txt
13. append write:
Echo "hello, world"> a.txt
14. view files
Cat a.txt
15. Completely clear the file
Move the cursor down to the last line
Input:
: 1,. d press ENTER