1, lists unit
command | Explanation |
systemctl list-units |
List all running unit |
systemctl list-unit-files | Lists all available units |
systemctl --failed | List all failed unit |
systemctl list-unit-files --type service | List all services |
2, start, restart, stop, service and overloaded boot from the start the service, cancel the start-up , service is prohibited, lift the ban (such as httpd.service service)
command | Explanation |
systemctl start httpd.service | Start httpd service |
systemctl restart httpd.service | Service httpd restart |
systemctl stop httpd.service | Stop the httpd service |
systemctl reload httpd.service | Service httpd reload |
systemctl enable httpd.service | Set boot from the start httpd service |
systemctl disable httpd.service | Cancel start-up service httpd |
systemctl mask httpd.service |
Prohibit service httpd |
systemctl unmask httpd.service | Cancel service httpd ban |
Note: when we start using the systemctl command, restart, stop, when the reload option, the terminal will not output anything, only the status option to print output.
3, check the service status, check whether the service starts, the service checks the boot is started (such as httpd service)
command | Explanation |
systemctl status httpd.service | View httpd service status |
systemctl is-active httpd.service |
View httpd service is started |
systemctl is-enabled httpd.service | Check whether the service httpd boot from the start |
4, using the command kill systemctl services (such as: killing crond Service)
command | Explanation |
systemctl kill crond | Kill crond service |
5, lists all of the mount points system
command | Explanation |
systemctl list-unit-files --type mount | All system mount points listed |
6, loading, unloading and re-loading, system overload mount point, and the system checks the state of mount points (eg: tmp.mount mount point)
command | Explanation |
systemctl start tmp.mount | Mounting |
systemctl stop tmp.mount | Uninstall |
systemctl restart tmp.mount | Remount |
systemctl reload tmp.mount | Overload |
systemctl status tmp.mount | Check Status |
7, boot automatically mount, canceled boot mount, the mount point is enabled to see, to see if the boot automatically mount
command | Explanation |
systemctl is-active tmp.mount | View mount point is enabled |
systemctl enable tmp.mount | Set the boot automatically mount |
systemctl disable tmp.mount | Cancellation boot automatically mount |
systemctl is-enabled tmp.mount | See if the boot automatically mount |
8, prohibits any action mount point, and stop running; unblock
command | Explanation |
systemctl mask tmp.mount | Ban |
systemctl unmask tmp.mount | Unblock |
9, listing all available system socket system
command | Explanation |
systemctl list-unit-files --type socket | Lists all available system socket |
10, a service check of all configuration details (eg: httpd service)
command | Explanation |
systemctl show httpd.service | Check the httpd service all configuration details |
11, to obtain a service list of dependencies (eg: httpd service)
command | Explanation |
systemctl list-dependencies httpd.service | Get httpd service dependency list |
12, start rescue mode
command | Explanation |
systemctl rescue | Start rescue mode |
13, into the emergency mode
command | Explanation |
systemctl emergency | 进入紧急模式 |
14、运行级别
命令 | 说明 |
systemctl get-default | 查看默认的运行级别 |
systemctl isolate graphical.target 或 systemctl isolate runlevel5.target |
启动运行级别5(图形模式) |
systemctl isolate multi-user.target 或 systemctl isolate runlevel3.target |
启动运行级别3(命令行模式) |
systemctl set-default graphical.target 或 systemctl set-default runlevel5.target |
设置图形模式为默认运行级别 |
systemctl set-default multi-user.target 或 systemctl set-default runlevel3.target |
设置命令行模式为默认运行级别 |
系统运行级别说明如下:
Runlevel 0:关闭系统
Runlevel 1:单用户模式
Runlevel 2:多用户,命令行模式(无网络)
Runlevel 3:多用户,命令行模式
Runlevel 4:保留
Runlevel 5:多用户,图形化模式
Runlevel 6:重启系统
转载于:https://blog.51cto.com/13716812/2410393