Permission related commands

su switch users (root users do not need to enter passwords to switch to other users, ordinary users need to enter passwords to switch to other users)

su - Ylem: switch to Ylem user

chown Change the owner of a file or folder

chown user: user group file/folder: chown wzx: root hades01 [change the owner of the hades01 file to wzx whose user group is root]

chown -R wzx:root hades02 [Change the owner of the hades02 folder and all files/folders in the folder to wzx whose user group is root]

chmod change file/folder permissions

A file/folder has a total of 10 characters. The first character represents the file type, and the latter is divided into 3 groups. The 3 characters represent the permissions of the user, the permissions of the same group, except the permissions of the user and others in the same group.

File type: - [normal file]; d [folder]; l [symbolic link file, similar to shortcut]; s [soket file]; p [pipe file pipe]

Permission: r [4 read permission]; w [2 write permission]; x [1 execute or switch permission]; - [0 no permission]

Permission number meaning: 0 [No permission]; 1 [Execute and switch permission] 2 [Write permission]; 3 [Execute and write permission (can be read if able to write)]; 4 [Read permission]; 5 [Execute and read permissions]; 6 [Read and write permissions]

chmod -R 777 hades02 [change the permissions of the hades02 folder and all files/folders in the folder to 777]

View disk and free space

df displays the free space of the specified disk file

du shows disk space usage for each file and directory

du -h: display in units of K, M, G

du -sh: Display the overall space usage of the current folder

du -sh ./* : Display the size of all files and folders under the current folder (folders will not be displayed one level further)

free displays the space and memory used by the system

free -k: view in kb

free -m: view in mb

free -g: view in gb

netstat -ntpl: view ports

If there is any infringement, please contact by email, I am sorry.

This is only for learning personal notes, and if there is any reprint, please indicate the source.

Contact Email: [email protected]

Learn to test the penguin group together (chat, water group, do not disturb advertising): 826471103

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324328248&siteId=291194637