Linux Command-Class 4, linux Command-4
1. System Management and Maintenance
1. pwd: print working directory
2. cd: change directory to change or enter the path
● Cd ~ /Cd: current user directory; return to the main directory (with spaces in the middle !)
● Cd/: root directory;
● Cd-: The Last accessed directory;
● Cd...: directory at the upper level
● Cd "I have fun" Open the folder with spaces in the middle of the name and use ""
● Cd I \ have \ fun/open the folder with spaces in the middle of the name and use \ translation Space
● Cd.../... go up to the third-level directory (the current directory is the first level)
3. rmdir: remove directory Delete path
4. pushd: push directory push path
5. popd: pop directory launch path
6. xargs: execute arguments execution Parameters
7. find: find files
For example, find.-name "*. txt"-print | less searches for all the files ending with txt and outputs them to the screen for display using the less command. The computer will find all the Matching content in the current folder and subfolders.
8. grep: find things inside files to find the content in the file
9. man: mannual page searches for related usage by command name, such as man find, and displays relevant parameters of the find command.
10. apropos: find what man page is appropriate find the appropriate manual page/if you do not know the name of the command required to complete a specific task, you can use a keyword to search for it through the Linux apropos Utility
11. env: look at your environment to view the environment. For example: env | grep huguagnqin env | less
12. echo: print some arguments print parameters, print the shell variable value in shell, or directly output the specified string
13. export: export/set a new environment variable
14. exit: exit the shell to exit the command line
15. sudo: become super user root becomes a super user or root
16. su: switch to the superuser permission exit and directly switch back to the common user.
17. chmod: change permission modifiers modify File permission
18. chown: change ownership modify the file owner
19. clear: clear screen
20. |: the pipeline command directs the command output on the left to the right
21. shutdown command:
Poweroff
Halt
Shutdown-h now (for root users)
22. reboot: restart
23: ps: View Processes
●-E: displays all programs;
●-F: displays the UID/PPIP/C/STIME field;
24: kill: Delete the program or work in progress;
●-I <Information No.>:
●-9 pid: Force termination;
Ii. File Management and editing
1. mkdir: make directory Creation Path
●-P: if the parent directory does not exist, create the parent directory first.
●-V: displays detailed information during command execution (verbose: lengthy, detailed)
2. ls: list directory
●-L: detailed format list (simplified command: ll is provided)
●-A or -- all: list all files and directories in the current directory, including hidden files/special files ..
●-T: sort by the last modification time of the file (the last modification is on the top)
●-R: reverse sorting
3. cp: copy a file or directory: copy the file (the existing file will be overwritten)
●-R: recursive replication, Which is used together with files in the folder (this parameter must be added to the copy directory)
● Cp [parameter] [source file or directory] [target file or directory]
4. mv: move a file or directory move a file or path
● Mv [source file or directory] [target file or directory]
●-F/-- force: if the target file is the same as the existing file, it will be overwritten directly.
5. less: page through a file page by page
●-M: Percentage of displayed content
●-N: displays the row number.
Operation:
● Q: exit to view
● Space/pageDown: Page flip forward
● B/pageUp: Page flip
● D: half page forward
● U: half page backward
● Enter/downward arrow key: forward row
● Y/UP direction key: back a row
●/: Downward search (available in vi)
●? : Search up (available in vi)
● V: Enter vim;
● Left and right direction keys: equivalent to horizontal scroll bars;
6. cat: print the whole file print the output of the entire file
7. touch: Create a new file
8. mv: rename a file
9. rm: delete an object
●-R or-R: recursive processing. All files in the specified directory are processed together with subdirectories;
●-F: forcibly delete a file or directory;
●-I: Ask the user before deleting an existing file or directory;
10. <: send the file on the right to the program on the left as input.
11.>: Write the output of the command on the left to the file on the right.
For example, after executing the cat> newfile.txt command, you will be directed to the newly created newfile.txt file on the screen, and press ctrl + d to end.
12. >>: append the command output on the left to the file on the right.
13. *: wildcard. *. Txt-any file ending with txt
14. grep: global regular expression print: global regular expression. Use a regular expression to search for text and print the matched rows.
15. tail: displays the content at the end of the specified file.
●-N <number of rows> displays the number of rows;
●-F: cyclically read;
● &: Indicates running in the background; otherwise, the terminal is occupied
● Ctrl + c: Exit
Iii. compression and decompression
1. tar: Backup compression command
●-Z: Use the gzipcommand to decompress Or compress the file in the format of ..tar.gz.
●-J: Call bzip2command to decompress Or compress the file, .tar.bz2;
●-X: extract (extract)
●-C: compression (create)
●-V: displays the file (verbose) during compression)
●-F: name of the document to be decompressed or compressed
● Decompress the combined command:-zxvf/-jxvf
● Compressed to the combined command:-zcvf/-jcvf
Iv. network settings and Maintenance
1. hostname: my computer's network name the name of the computer in the network
2. ifconfig: displays network devices and ip addresses.
3. ping: test the connectivity with the target host. ping the host name/IP address.