Linux switching and editing commands

Working directory switch command

1. pwd: used to display the working directory of the current user.
2. cd: switch the working path
(1) cd -: return to the previous directory
(2) cd …: return to the previous directory
(3) cd ~: switch the current user’s home directory
3. ls: display the current directory File information
(1) ls -a: see all files
(2) ls -l: view file information such as file attributes and size
(3) ls -al: view all files
(4) ls -l /etc: directory All contents under
(5) ls -ld/etc: detailed information of the current directory

Text file editing commands

1. cat: view the plain text file, the text content is relatively small
(1) cat -n: add a number to the content
2. more: view the plain text file, the text content is relatively large
3. head: view the first few lines of the text document
(1) head -n: specify the number of lines
4. tail: view the last few lines of the text document
(1) tail -f: refresh the file in real time
5. tr: replace the characters in the text file
| (pipe character): the previous command The output is used as the standard input of the next command.
6. wc: count the number of lines, words, and bytes of the specified text
(1) wc -l: number of lines
(2) wc -w: number of words
(3) wc -c: words Number of sections:
1 Chinese = 2 bytes
7. stat: View the specific storage information and time of the file.
Access: the time when the file content was last viewed.
Modify: the time when the file content was last modified.
Change: the last time the file attributes were changed. Permission time
8. cut: used to extract text characters by "columns"
(1) cut -f: set the number of columns to be viewed
(2) cut -d: set the spacer
9. diff: used to compare two text files The difference
(1) diff -c: describe the difference in the specific content of the file

Guess you like

Origin blog.csdn.net/A147254/article/details/108649386