III. Orders
3.1 File Directory Classes
●ls command
ls: lists files and subdirectories in the current directory
ls -a: lists all files and subdirectories in the current directory, including hidden files and directories
ls -R: recursively lists all files and subdirectories in the current directory and its subdirectories
●cd to switch directories
cd - : go back to the last directory
cd ... : opens the previous directory of the current directory
●mkdir、rmdir
(1) mkdir: create a directory
mkdir -p creates a multi-tier directory, mkdir -p linux/mingling/mkdir
(2) rmdir: delete directory
rmdir linux/mingling/mkdir
●cp: copy a file or directory
●cat View file contents
cat Displays the contents of the file
● rm to delete a file or directory
rm -r recursively deletes the directory and its contents
●Touch creates empty files
3.2 File Permission Class
● Document properties
Use the ll or ls -lh command to view permissions
-:No authorization
●chmod Change permissions
chmod u+x Modify the file so that its owner, user u, has execute privileges.
chmod g+x Modify the file to give execution privileges to user g, the group to which it belongs.
chmod u-x,o+x Modify the execution privilege of the main user to whom the file belongs, and make the other user o have execution privilege.
●chown: change owner
3.3 Search and Find Classes
●find Find a file or directory
find /home/ -name ""
●locate Locate the file path
3.4 User management classes
●whoami to view the current user
●adduser Add new user
useradd User name
useradd -g group name username (to add a new user to a group)
●passwd Set user password
passwd username (executed by root user)
●Switching users
User name (switching users, only the user's execution rights can be obtained)
- User name (to switch to a user and get that user's environment variables and execute permissions)
-i switch root user
●userdel Delete user
userdel user name (deletes the user, but preserves the user's home directory)
userdel -r username (both the user and the user's home directory are deleted)
3.5 Compression and Decompression Classes
●gzip/gunzip compression
Only files can be compressed, not directories
(1)gzip
(2)gunzip
●zip/unzip compression
You can compress the catalog and keep the source files
(1) zip compressed file name.zip source file
Compressed file zip
Compress the folder zip -r
(2) unzip
unzip
-d Specify the directory where the extracted files will be stored
unzip -d /opt
●tar Packaging
(1) Compressed files
tar -zcvf The name of the packaged file. [source file]
Packaging multiple files tar -zcvf
Packaging folder tar -zcvf moumou/
(2) Unzip the file
Extract to current directory tar -zxvf
-C Extract to a directory tar -zxvf -C /opt
3.6 Common dos commands
● ; Command 1; Command 2 (Multiple commands are executed sequentially without any logical relationship between the commands)
●&& Command 1&& Command 2 (Command 2 will be executed correctly only after 1 is executed correctly, otherwise 2 will not be executed)
●|| Command 1 || Command 2 (Command 2 will be executed correctly only after 1 is executed incorrectly, otherwise 2 will not be executed)
● | Command 1 | Command 2 (the correct output of Command 1 is used as the operation object of Command 2)
●# What follows is a comment and will not be executed.
●. Dot One . represents the current directory, and two . for the upper directory
Slash A path separator in path representation; a single occurrence refers to the root directory.
3.1 File Directory Classes
●ls command
ls: lists files and subdirectories in the current directory
ls -a: lists all files and subdirectories in the current directory, including hidden files and directories
ls -R: recursively lists all files and subdirectories in the current directory and its subdirectories
●cd to switch directories
cd - : go back to the last directory
cd ... : opens the previous directory of the current directory
●mkdir、rmdir
(1) mkdir: create a directory
mkdir -p creates a multi-tier directory, mkdir -p linux/mingling/mkdir
(2) rmdir: delete directory
rmdir linux/mingling/mkdir
●cp: copy a file or directory
●cat View file contents
cat Displays the contents of the file
● rm to delete a file or directory
rm -r recursively deletes the directory and its contents
●Touch creates empty files
3.2 File Permission Class
● Document properties
Use the ll or ls -lh command to view permissions
-:No authorization
●chmod Change permissions
chmod u+x Modify the file so that its owner, user u, has execute privileges.
chmod g+x Modify the file to give execution privileges to user g, the group to which it belongs.
chmod u-x,o+x Modify the execution privilege of the main user to whom the file belongs, and make the other user o have execution privilege.
●chown: change owner
3.3 Search and Find Classes
●find Find a file or directory
find /home/ -name ""
●locate Locate the file path
3.4 User management classes
●whoami to view the current user
●adduser Add new user
useradd User name
useradd -g group name username (to add a new user to a group)
●passwd Set user password
passwd username (executed by root user)
●Switching users
User name (switching users, only the user's execution rights can be obtained)
- User name (to switch to a user and get that user's environment variables and execute permissions)
-i switch root user
●userdel Delete user
userdel user name (deletes the user, but preserves the user's home directory)
userdel -r username (both the user and the user's home directory are deleted)
3.5 Compression and Decompression Classes
●gzip/gunzip compression
Only files can be compressed, not directories
(1)gzip
(2)gunzip
●zip/unzip compression
You can compress the catalog and keep the source files
(1) zip compressed file name.zip source file
Compressed file zip
Compress the folder zip -r
(2) unzip
unzip
-d Specify the directory where the extracted files will be stored
unzip -d /opt
●tar Packaging
(1) Compressed files
tar -zcvf The name of the packaged file. [source file]
Packaging multiple files tar -zcvf
Packaging folder tar -zcvf moumou/
(2) Unzip the file
Extract to current directory tar -zxvf
-C Extract to a directory tar -zxvf -C /opt
3.6 Common dos commands
● ; Command 1; Command 2 (Multiple commands are executed sequentially without any logical relationship between the commands)
●&& Command 1&& Command 2 (Command 2 will be executed correctly only after 1 is executed correctly, otherwise 2 will not be executed)
●|| Command 1 || Command 2 (Command 2 will be executed correctly only after 1 is executed incorrectly, otherwise 2 will not be executed)
● | Command 1 | Command 2 (the correct output of Command 1 is used as the operation object of Command 2)
●# What follows is a comment and will not be executed.
●. Dot One . represents the current directory, and two . for the upper directory
Slash A path separator in path representation; a single occurrence refers to the root directory.