Home>Article>Operation and Maintenance> Summarize centos7 common operation commands
The following is a summary of common centos7 operating commands from thecentostutorial column. I hope it will be helpful to friends in need!
Basic operation
##cd /Enter the root directory
cd usr/local /javaEnter the java directory
##cd ..Return to the upper directory
historyView all previously executed commands
cp file1 file2Copy file1 to file2
cp -a dir1 dir2Copy a directory
llList the detailed file list in the current directory
touch xxx.txtCreate a file of a specific type
mkdir dir1Create a directory named "dir"
mv dir1 dir2Move/rename a directory
rm -f file1Delete 'file1 '
rm -rf dir1Delete the contents of the 'dir1' directory and its subdirectories
File modificationvi file
Open and browse the file
##File decompression and packaging
tar -cvf file1
.tar.gz file1Pack file1 intofile1.tar.gz(-c: Create a compressed archive; -v: Display all processes; -f: Use the file name, which is required and is the last parameter)tar -xvf file1.tar. gz
Extract a package##tar -xvf file1.tar.gz -C /tmp
Release the compressed package to the /tmp directoryyum installer
yum -y update
Update all rpm packages installed in the current systemyum -y install [package]
Download and install an rpm packageyum update [package]
Update An rpm packageyum remove [package]
Delete an rpm packageyum list
List all packages installed in the current systemyum clean all
Delete all cached packages and header filesNetwork related
ip addr
Display the IP address of the network cardsystemctl status firewalld
View the firewall Statussystemctl stop firewalld.service
Close the firewall directlysystemctl disable firewalld.service
Disable firewall startup at bootsystemctl restart network
Restart network service##ntpdate cn.pool.ntp.orgUpdate system time
netstat -lnpt |grep port numberCheck whether the port is occupied
Disk management
df -hlView remaining disk space
df -hView each The partition size of the root path
du -sh [directory name]Return the size of the directory
du - sm [folder]Return the total number of M in the folder
du -h [directory name]View all files in the specified folder File size (including subfolders)
Solutions to some problems
1) When encountering the newly created xxx.sh When the file is white, you need to turn the file into an executable green file. The command is as follows:
chmod 777 *.sh or chmod x *.sh
2) When using the./startup.shcommand under the bin directory, it prompts that the permissions are insufficient. , execute the following command in the bin directory
chmod u x *.sh
The above is the detailed content of Summarize centos7 common operation commands. For more information, please follow other related articles on the PHP Chinese website!