遇到命令不知道添加哪个参数,可以使用命令帮助查看相关介绍。
查看手册页或命令描述。
[root@localhost ~]# man find
man命令查看帮助时,支持上下翻页(↑,↓)、搜索(“/关键字”进行搜索);退出使用q
[root@localhost ~]# find –help
[root@localhost ~]# shutdown #关机
[root@localhost ~]# reboot #重启
[root@localhost ~]# poweroff #关机
作用:关机、重启、定时关机
语法:shutdown 【选项】
参数:
-r #重启
-h #关机
-h 时间 #定时关机
举例:
[root@localhost ~]# shutdown -h +10 #10分钟之后关机
[root@localhost ~]# shutdown -h 23:30 #指定具体时间点,进行关机
[root@localhost ~]# shutdown -h now #立即关机
[root@localhost ~]# shutdown -r 22:30 #指定具体时间点,进行重启
作用:切换系统运行级别
语法:init 0-6
Linux 7个启动级别:
0表示系统停机模式,系统默认运行级别不能设置为0,否则不能正常启动。
1表示单用户模式,root权限,用于系统维护,禁止远程登录。
2表示多用户模式,没有NFS和网络支持。
3表示完整的多用户文本模式,有NFS和网络,登录后进入控制台命令模式。
4表示系统未使用,保留一般不用,如果笔记本电脑点错用尽,可切换此模式做一些配置。
5表示图形化模式,登录后进入图形GUI模式。
6表示重启模式,默认运行级别不能设置为6,否则不能正常使用
举例:
[root@localhost ~]# init 0 #关机
[root@localhost ~]# init 3 #进入字符界面
[root@localhost ~]# init 5 #进入图形界面
[root@localhost ~]# init 6 #重启
查看默认启动级别
[root@localhost ~]# systemctl get-default
graphical.target
[root@localhost ~]# systemctl set-default multi-user.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.
[root@localhost ~]# 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.
由级别3切换到级别5
[root@localhost ~]# runlevel 3 5
Too many arguments.
原文:https://www.cnblogs.com/ai-fei-ai/p/14177286.html