Common Linux Commands
This article is reprinted from Linux common command, delete
System Service Management
systemctl
The systemctl command is a combination of the service and chconfig commands to manage the system.
- Output the status of each service in the system
systemctl list-units --type=service
Copy the code
- View the running status of the service
systemctl status firewalld
Copy the code
- Close the service
systemctl stop firewalld
Copy the code
- Start the service
systemctl start firewalld
Copy the code
- Restarting the service (regardless of whether the service is up or down)
systemctl restart firewalld
Copy the code
- Reloads the configuration without interrupting service
systemctl reload firewalld
Copy the code
- Disable service startup upon startup
systemctl disable firewalld
Copy the code
- Setting boot
systemctl enable firewalld
Copy the code
File management
ls
List all files in the specified directory and the files in the root directory
Ls minus L over l is the same thing as LLCopy the code
pwd
Gets the absolute path to the current working directory
pwd
Copy the code
cd
Change working directory
cd /usr/local
Copy the code
date
Displays or modifies the system time and date
date '+%Y-%m-%d %H:%M:%S'
Copy the code
passwd
User Sets the user password
passwd root
Copy the code
su
Changing user Identity
clear
Clear screen information
man
Displays help information about a specified command
man ls
Copy the code
who
- What health level is the system in
who -r
Copy the code
- Displays the current users logged in to the system
who -buT
Copy the code
free
Display system memory status in MB
free -m
Copy the code
ps
- Displays the running status of system processes
ps -ef
Copy the code
- To view
sshd
Running status of a process
ps -ef | grep sshd
Copy the code
top
View live active processes, similar to Windows task Manager.
mkdir
Create a folder mkdir /mydata
more
Used to view files in pages, columns such as 10 lines per page to view boot.log files
more -c -10 /var/log/boot.log
Copy the code
cat
View a file, such as a Linux startup log file, and label the line number
cat -Ab /var/log/boot.log
Copy the code
touch
This command is used to create files, such as text.txt files
touch text.txt
Copy the code
rm
- Delete the file
rm text.txt
Copy the code
- Forcibly delete a directory and its subdirectories
rm -rf testdir
Copy the code
cp
Used to copy files, such as directory test1 to directory test2
cp -r /mydata/test1 /mydata/test2
Copy the code
mv
Used to move or overwrite files