Home  >  Article  >  Operation and Maintenance  >  Summarize centos7 common operation commands

Summarize centos7 common operation commands

藏色散人
藏色散人forward
2021-05-24 15:28:015166browse

The following is a summary of common centos7 operating commands from the centos tutorial column. I hope it will be helpful to friends in need!

Basic operation

##cd / Enter the root directory

cd usr/local /java Enter the java directory

##cd ..

Return to the upper directory

history

View all previously executed commands

cp file1 file2

Copy file1 to file2

cp -a dir1 dir2

Copy a directory

ll

List the detailed file list in the current directory

touch xxx.txt

Create a file of a specific type

mkdir dir1

Create a directory named "dir"

mv dir1 dir2

Move/rename a directory

rm -f file1

Delete 'file1 '

rm -rf dir1

Delete the contents of the 'dir1' directory and its subdirectories

File modification

vi file

Open and browse the file

##File decompression and packaging

tar -cvf file1

.tar.gz file1 Pack file1 into file1.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 directory

yum installer

yum -y update

Update all rpm packages installed in the current system

yum -y install [package]

Download and install an rpm package

yum update [package]

Update An rpm package

yum remove [package]

Delete an rpm package

yum list

List all packages installed in the current system

yum clean all

Delete all cached packages and header files

Network related

ip addr

Display the IP address of the network card

systemctl status firewalld

View the firewall Status

systemctl stop firewalld.service

Close the firewall directly

systemctl disable firewalld.service

Disable firewall startup at boot

systemctl restart network

Restart network service

##ntpdate cn.pool.ntp.org Update system time

netstat -lnpt |grep port number Check whether the port is occupied

Disk management

df -hl View remaining disk space

df -h View 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.sh command 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!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete