[[Email protected] Desktop]# hostnamectl set-hostname Server change name
I. Copy, delete, move
– Create a subdirectory under directory/opt NTD
[Email protected]/]# cd/opt/
[Email protected] opt]# mkdir NTD1
[[email protected] opt]# ls
– Create file Readme.txt in directory/opt/ntd/, write content with vim I love Linux
– Copy the/etc/passwd and/etc/resolv.conf to the/OPT/NTD directory at the same time
– Copy file/etc/redhat-release to/root/and rename to Version.txt
– Move the file/root/version.txt to the/opt/ntd/directory
1.CP command
Format: CP [Options] ... Original file ... Target path
Common Command Options
-R: Recursive, must have this option when copying directories
-P: Keep the original file permissions, modification time and other properties unchanged
3.MV Move or rename
Format: MV [options] ... Original file ... Target path
2.RM Delete
Format: RM [Options] ... File or directory ...
Common Command Options
-R,-f: Recursive delete (with directory), forced delete
Two. User. Group
Create a user account named stu02
New group Account Stugrp
change user stu02 user name to stu03
Create user
# ID Account name Verify that the system exists for this account
# useradd account name Create account
Set Password
#passwd account Setup Password
Modify account information
#usermod
-L new Account old account Change login name
Delete Account
Delete an account #userdel account
-R along with home directory delete
Create a group
#groupadd Group Name
-G GID specifies GID when creating group
Add a Delete member (user) to a group
#gpasswd
-A: Add specified user as group member
-D: Delete the specified member user from within the group
C. Deleting a group
#groupdel Group Name
Three. Backup and recovery
– Backup/boot,/home folders, saved as boothome.tar.gz files
– Release boothome.tar.gz to Folder/root/boothome/
Make a. Tar package and compress
Basic usage
Format: TAR-ZCF backup file. tar.gz Document Path ...
Format: TAR-JCPF backup file. tar.bz2 Document Path ...
Format: TAR-JCF backup file. Tar.xz Document Path ...
Unzip. Tar Package
Basic usage
Format: TAR-XPF backup file. tar.gz
Format: tar-xf backup file. tar.bz2
Format: tar-xf backup file. tar.xz [-C destination Folder]
Four. What are the LS common options? The respective roles?
. ls command
Format: ls [options] ... [Directory or file path]
Common Command Options
-A: Includes the name with the. Hidden document at the beginning
-L: Display in long format
-H: Must be combined with-l to provide easy-to-read capacity units (K, M, etc.)
-D: Display the properties of a directory
Basic Linux Operations