• 1.1 login:用户登录系统
  • 1.2 logout:退出登录shell
  • 1.3 nologin:限制用户登录
  • 1.4 exit:退出shell
  • 1.5 sulogin:单用户登录(single user login)
  • 1.6 rlogin:远程登录
  • 1.7 poweroff:关闭系统
  • 1.8 ctrlaltdel:设置Ctrl+Alt+Delete组合键的功能
  • 1.9 shutdown:关闭或重启Linux系统
  • 1.10 halt:关闭系统
  • 1.11 reboot:重启Linux系统
  • 1.12 init:切换系统运行级别
  • 1.13 runlevel:输出以前和当前的运行级别
  • 1.14 telinit: 更改系统运行级别
  • 1.1 login:用户登录系统

    1.2 logout:退出登录shell

    1、等同于快捷键:Ctrl+D|d

    1.3 nologin:限制用户登录

    1、使用nologin命令可以限制某些用户通过shell登录系统。

    1.4 exit:退出shell

    1.5 sulogin:单用户登录(single user login)

    1、使用sulogin命令可以进行单用户登录,在启动时Shell将不会读取/etc/profile或$HOME/.profile文件

    2、实战

    [root@tqtlblog ~]# sulogin
    Give root password for maintenance
    (or type Control-D to continue):

    1.6 rlogin:远程登录

    1、描述:使用rlogin命令可以在当前本地主机系统的终端上连接到远程主机

    2、实战

    yum whatprovides rlogin
    yum install -y rsh

    1.7 poweroff:关闭系统

    描述:使用poweroff命令可以关闭Linux系统,关闭记录会被写入/var/log/wtmp日志文件中
    
    poweroff -n#关闭之前不同步



    poweroff -p#当被称为halt时关闭电源



    poweroff -v#增加输出,包括消息



    poweroff -q#降低输出错误唯一消息



    poweroff -w#并不实际关闭系统,只是写入/var/log/wtmp文件中



    poweroff -f#强制关机,不调用shutdown

    1.8 ctrlaltdel:设置Ctrl+Alt+Delete组合键的功能

    1.9 shutdown:关闭或重启Linux系统

    1、使用shutdown命令可以很安全地关闭或重启Linux系统。

    2、先使用sync将数据保存;

    3、优先使用shutdown命令进行关机和重启;

    实战

    shutdown -k “System wil be shutdown at 11:45”#并不执行shutdown,只是发出警告信息给all users
    shutdown -r now #重新启动Linux系统
    shutdown -r 01:30 #在01:38分重新启动Linux系统
    shutdown -h now#立即关闭系统
    shutdown -h 45#45min后关闭系统
    shutdown -c#取消运行shutdown的操作

    1.10 halt:关闭系统

    1、/var/log/wtmp是一个二进制文件,记录每个用户的登录次数和持续时间等信息;

    2、实战

    halt -w#并不是真正的关闭系统,只是写入/var/log/wtmp文件中
    halt -d#关闭系统,不把记录写入/var/log/wtmp日志文件中
    halt -n#关闭系统前不同步
    halt -f#没有调用shutdown而强制关闭系统
    halt -i#关闭系统前,关掉所有的网络接口

    1.11 reboot:重启Linux系统

    1、实战

    reboot -w#并不是真正的重启系统,只是写入/var/log/wtmp文件中
    reboot -d#重启系统,不把记录写入/var/log/wtmp日志文件中
    reboot -f#没有调用shutdown而强制重启系统
    reboot -n#重启系统前不同步

    1.12 init:切换系统运行级别

    1、描述:使用init命令可以切换系统的运行级别,init定义了7个运行级别,0~6

    2、/etc/inittab文件介绍

    [root@tqtlblog ~]# cat /etc/inittab
    # inittab is no longer used when using systemd.
    #
    # ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
    #
    # Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
    #
    # systemd uses 'targets' instead of runlevels. By default, there are two main targets:
    #
    # multi-user.target: analogous to runlevel 3
    # graphical.target: analogous to runlevel 5
    #
    # To view current default target, run:
    # systemctl get-default
    #
    # To set a default target, run:
    # systemctl set-default TARGET.target
    #
    [root@tqtlblog ~]#

    3、运行级别说明

    0: 关机
    1: 单用户
    2: 无网络的多用户
    3: 命令行模式
    4: 未用
    5: GUI(图形桌面 模式)
    6 : 重启

    1.13 runlevel:输出以前和当前的运行级别

    1、runlevel读取系统UTMP文件,如果没有指定该文件时,默认使用/var/run/utmp文件,以找到最近的运行级别的记录

    2、实战

    [root@tqtlblog ~]# runlevel
    N 3
    [root@tqtlblog ~]# init 5
    [root@tqtlblog ~]# runlevel
    3 5
    [root@tqtlblog ~]#

    1.14 telinit: 更改系统运行级别

    1、s或S是单用户模式;

    Linux命令应用大词典-第1章 登录、退出、关机和重启的更多相关文章

    1. Linux命令应用大词典-第41章 MySQL数据库

      41.1 mysqld_safe:MySQL服务器启动脚本 41.2 mysql_install_db:初始化MySQL数据目录 41.3 mysqlshow:显示MySQL数据库结构 41.4 my ...

    2. Linux命令应用大词典-第36章 密码和证书管理

      36.1 pwdhash:密码哈希生成器 36.2 mkpasswd:生成应用于用户的新密码 36.3 keytool:密钥和证书管理工具 36.4 certutil:证书服务器管理工具 36.5 v ...

    3. Linux命令应用大词典-第23章 进程和服务管理

      23.1 ps:报告当前进程的快照 23.2 top:显示当前正在运行的进程 23.3 pgrep:按名称和其他属性查找进程 23.4 pidof:查找正在运行的进程的进程号 23.5 pstree: ...

    4. Linux命令应用大词典-第22章 GRUB

      22.1 grub-md5-crypt:使用MD5格式加密口令 22.2 grub-install:在设备上安装GRUB 22.3 grub:进入GRUB命令shell 22.4 grub-crypt ...

    5. Linux命令应用大词典-第21章 LVM和RAID管理

      21.1 pvcreate:创建物理卷 21.2 pvscan:列出找到的物理卷 21.3 pvdisplay:显示物理卷的相关属性 21.4 vgcreate:创建卷组 21.5 vgscan:查找 ...

    6. Linux命令应用大词典-第19章 文件系统管理

      19.1 mkfs:创建Linux文件系统 19.2 mke2fs:创建ext2.3.4文件系统 19.3 mkfs.ext4:创建ext4文件系统 19.4 mkfs.ext3:创建ext3文件系统 ...

    7. Linux命令应用大词典-第18章 磁盘分区

      18.1 fdisk:分区表管理 18.2 parted:分区维护程序 18.3 cfdisk:基于磁盘进行分区操作 18.4 partx:告诉内核关于磁盘上分区的号码 18.5 sfdisk:用于L ...

    8. Linux命令应用大词典-第13章 用户和组群管理

      13.1 useradd:创建用户账户 13.2 adduser:创建用户账户 13.3 lnewusers:创建用户账户 13.4 usermod:修改用户账户 13.5 userdel:删除用户账 ...

    9. Linux命令应用大词典-第12章 程序编译

      12.1 gcc:GNU项目的C和C++编译器 12.2 gdberver:为GNU调试的远程服务器 12.3 cmake:跨平台的Makefile生成工具 12.4 indent:更改通过插入或删除 ...

    随机推荐

    1. Linux 下安装配置 JDK7 配置环境(debian 7)

      自从从Oracle收购Sun近三年来,已经有很多变化.早在8月,甲骨文将“Operating System Distributor License for Java”许可证终结,这意味着第三方将不可以 ...

    2. mysql大数据量使用limit分页,随着页码的增大,查询效率越低下

      1.   直接用limit start, count分页语句, 也是我程序中用的方法: select * from product limit start, count当起始页较小时,查询没有性能问题 ...

    3. JavaScript中操作有些DOM时关于文本节点和元素节点的问题。

      初学JavaScript时候,经常遇到需要操作的内容因为文本节点而使操作更麻烦或者不能达到效果. 例: <ul id="ull">    <li>111&l ...

    4. UVa 1412 - Fund Management(状压DP + 预处理)

      链接: https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem& ...

    5. HDU4609:3-idiots(FFT)

      Description Input Output Sample Input Sample Output Solution 题意:给你$n$根木棍,问你任选三根能构成三角形的概率是多少. 写挂sb细节心 ...

    6. httpd:RSA certificate configured for SERVER does NOT include an ID which matches the server name

      这个是因为ssl认证丢失了密钥的问题,Apache的默认配置文件加载了mod_ssl模块,而且指定密钥对儿的位置,就是我测试salt-api时创建密钥对儿的位置.而且还有一个错误就是我密钥对儿指定的h ...

    7. 【转】合格PHP工程师的知识结构

      PHP的运行环境 连环境都搞不起来,就是你有多么喜欢PHP,那也是白搭,开始我们大多会使用集成环境软件例如xampp,wamp.随着知识的增加慢慢要学会自己搭建运行环境,例如 Linux(Ubuntu ...

    8. Day4 数组

      双重for循环 外循环控制行,内循环控制列. //乘法表 ; i <= ; i++) { ; j <= i ;j++) { System.out.print(j+"*" ...

    9. Linux centos修改防火墙为iptables

      防火墙配置 CentOS 7默认使用的是firewall作为防火墙,这里改为iptables防火墙.  firewall操作: # service firewalld status; #查看防火墙状态 ...

    10. vagrant之道(即其工作流程)

      原文http://mitchellh.com/the-tao-of-vagrant The Tao of Vagrant 在安装vagrant或了解它如何工作之前,了解vagrant在实际工作环境中的 ...