systemctl服务------字符和图像界面切换systemctl set-default multi-user.target systemctl isolate multi-user.target #当前立即进入字符模式 [root@room4pc09 桌面]# systemctl isolate graphical.target #当前立即进入图形模式

  • 查看服务运行状态
[root@room4pc09 桌面]# systemctl status crond       #查看服务运行状态
● crond.service - Command Scheduler
   Loaded: loaded (/usr/lib/systemd/system/crond.service; enabled; vendor preset: enabled)
   Active: active (running) since 二 2019-01-29 21:52:22 CST; 1 day 12h ago
 Main PID: 1403 (crond)
   CGroup: /system.slice/crond.service
           └─1403 /usr/sbin/crond -n

1月 29 21:52:22 room4pc09.tedu.cn systemd[1]: Started Command Scheduler.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 查看服务是否开启
[root@room4pc09 桌面]# systemctl is-enabled crond.service #查看服务是否开启 
enabled
  •  
  • 查看服务是否活跃
[root@room4pc09 桌面]# systemctl is-active crond
active
  • 1
  • 2
  • 字符模式:multi-user.target
  • 图形模式:graphical.target
[root@room4pc09 桌面]# systemctl get-default   #查看默认模式
multi-user.target
  • 1
  • 2
    systemctl set-default multi-user.target
  • 设置默认的运行模式
[root@room4pc09 桌面]# systemctl set-default graphical.target  #设置为图形模式 
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
[root@room4pc09 桌面]# systemctl get-default  #查看默认模式
graphical.target
[root@room4pc09 桌面]# reboot               #重启
  •  
[root@room4pc09 桌面]# systemctl isolate multi-user.target   #当前立即进入字符模式
[root@room4pc09 桌面]# systemctl isolate graphical.target  #当前立即进入图形模式
原文地址:https://www.cnblogs.com/xuanbjut/p/14235111.html