Re-learn Python, learn python
Common commands and usage methods are as follows:
Man
Man command # query command usage
Cat and tac
Cat displays the file content in a forward order.
Tac is the content of the reverse display file
Sort
Sort File Content
Uniq
Ignore duplicate rows in the file
History
Display input History commands. Generally, save the two thousand-line command.
More
The more command is similar to cat. The cat command displays the content of the entire file on the screen from top to bottom. More is displayed on one page for users to read on one page.
Less
The less tool is used to display files or other outputs by page.
Head and tail
1. If you only want to view the first five lines of the file, you can use the head command, for example:
Head-5/etc/passwd
2. If you want to view the last 10 lines of the file, you can use the tail command, such:
Tail-10/etc/passwd or tail-n 10/etc/passwd
Tail-f/var/log/messages
PS: tail-f can constantly refresh logs
Linux Permissions
View Permissions
Linux File Access Permissions are divided into three types: readable, writable, and executable.
Run the ls-l command, for example:
Ls-l
Display
-Rwxr-xr-x 1 root 6444 09-22 shmwrite
-Rw-r -- 1 root 1443 09-22 shmwrite. c
Drwxr-xr-x 2 root 4096 09-22 test
The first character represents the file type. D indicates a directory.-indicates a non-directory.
Next, each three characters is a group of permissions, which are divided into three groups, which represent the owner permissions, the same group of user permissions, and other user permissions.
The three characters of each group of permissions indicate whether the permissions are readable, writable, and executable.
R indicates that you have read permission.
W indicates that you have the write permission.
X indicates that you have the executable permission.
-This permission is not granted.
Modify permissions
You can use the chmod command to modify file permissions.
For example:
Chmod 754 test
4 indicates read permission, 2 indicates write permission, and 1 indicates execution permission.
7 = 4 + 2 + 1, indicating that you have the permission to read, write, and execute
5 = 4 + 1, indicating that the account has the permission to read and execute but does not have the write permission
0 indicates that you do not have any permissions.
Locate
Locate/etc/sys # search all files starting with sys in the etc directory
Locate ~ /A # search for all files starting with a in the main directory
Locate · I ~ /A # search all files starting with a in the main directory, but the case sensitivity of a is not