- Delete
RM-RF Directory name RM filename (delete file directly)
-R: Recursive down, no matter how many levels of directory, delete
-F: Directly forcibly delete, do not do any hint
- View Instructions Help
Man instruction Name
For example: Man RM
- chmod: Change the call permissions of a file
Directive Name: chmod
Usage rights: All users
Mode of use: chmod [-CFVR] [--help] [--version] Mode file ...
Description: Linux/unix's file invocation permissions are divided into three levels: file owners, groups, and others. The use of chmod can be used to control how files are called by others.
Parameters:
Mode: Permission set string in the following format: [Ugoa ...] [[+-=][RWXX] ...] [,...], where
U represents the owner of the file, G means that the owner of the file belongs to the same group (group), and O indicates that the other person, a means that all three are.
+ indicates an increase in permissions,-represents a cancellation permission, = Represents a unique set of permissions.
R is readable, w means writable, x is executable, x means only if the file is a subdirectory, or the file has been set as executable.
-C: If the file permissions have changed, the change action will be displayed
-F: Do not display an error message if the file permissions cannot be changed
-V: Show details of permission changes
-r: The same permissions change for all files in the current directory and subdirectories (that is, they are changed in a recursive manner)
Help: Show Auxiliary instructions
–version: Display version
Example: Set the file file1.txt to be read by everyone:
chmod ugo+r File1.txt
Set the file file1.txt to be readable by everyone:
chmod a+r File1.txt
The file file1.txt and File2.txt are set as the owner of the file, and the same group as the person to which they belong can be written, but others other than the other are not writable:
chmod ug+w,o-w file1.txt File2.txt
Set ex1.py to only the owner of the file can perform:
chmod u+x ex1.py
Set all files and subdirectories in the current directory to be readable by anyone:
Chmod-r A+r *
In addition chmod can also use numbers to represent permissions such as chmod 777 file
The syntax is: chmod ABC file
Each of the a,b,c is a number that represents the permissions of the user, Group, and other respectively.
R=4,w=2,x=1
To rwx the attribute then 4+2+1=7;
To rw-the attribute then 4+2=6;
To r-x the property, 4+1=5.
Example:
chmod a=rwx File
And
chmod 777 File
Same effect
chmod ug=rwx,o=x File
And
chmod 771 File
Same effect
- chown: Change the owner or group of a file
Usage:
- 1 Changing the owner of a file
chown jim program.c
The owner of the file changes to Jim, and as the owner, Jim can use the chmod command to allow or deny access to other users PROGRAM.C
-
- Change the owner of a directory
chown -R username:usergroup /tmp/src
Change the owner and group of all files in directory/tmp/src to user username and groups UserGroup
- Unzip
tar –xvf file.tar //解压 tar包tar -xzvf file.tar.gz //解压tar.gztar -xjvf file.tar.bz2 //解压 tar.bz2tar –xZvf file.tar.Z //解压tar.Zunrar e file.rar //解压rarunzip file.zip //解压zip
The Linux command I used