Linux基础入门

                  Linux基础入门

                                           作者:尹正杰

版权声明:原创作品,谢绝转载!否则将追究法律责任。

 

 

 

一.用户登录

root 用户  
  一个特殊的管理帐户
  也被称为超级用户
  root已接近完整的系统控制
  对系统损害几乎有无限的能力
  除非必要,不要登录为root

普通( 非特权 )用户
  权限有限
  造成损害的能力比较有限

 

二.终端terminal 

设备终端  
  主要指物理设备,可以看得见摸得着的,如:键盘、鼠标、显示器。

物理终端( /dev/console )
  控制台console,比如去机房接入的KVM中,我们在显示器上看到的窗口就是物理终端。

串行终端( /dev/ttyS# )
  ttyS,主要指用线缆连接的终端,比如我们使用思科,H3C交换机需要使用Console线进行连接,通过Console接口插入,在通过转换器转换成USB接口,插入电脑后,使用相应的软件进行连接输入相应的设备命令来本地管理设备的方式,现在基本上都为设备配置了IP地址,工作中我们基本上远程操作接口,除非你第一次去机房上线这台设备会用到。

虚拟终端(tty:teletypewriters, /dev/tty#
  tty 可有n个,Ctrl+Alt+F#

图形终端( /dev/tty7 ) startx, xwindows
  CentOS 6: Ctrl + Alt + F7
  CentOS 7: 在哪个终端启动,即位于哪个虚拟终端

伪终端( pty:pseudo-tty , /dev/pts/# )
  pty, SSH远程连接

查看当前的终端设备:
  tty

 

三.交互式接口

交互式接口:
  启动终端后,在终端设备附加一个交互式应用程序

GUI:Graphic User Interface(图形化运行环境,一般适合初学者学习)
  X protocol, window manager, desktop
  Desktop:
    GNOME (C, 图形库gtk),
    KDE (C++,图形库qt)
    XFCE (轻量级桌面)

CLI:Command Line Interface(字符运行环境,生产环境一般用这种)
  shell程序

 

四.Shell解释器

1>.什么是shell

Shell是Linux系统的用户界面,提供了用户与内核进行交互操作的一种接口。 它接收用户输入的命令并把它送入内核去执行  
shell也被称为LINUX的命令解释器(command interpreter)
shell是一种高级程序设计语言

2>.各种shell

一.Linux有很多shell种类,常见的有:
  sh (Steve Bourne )
  csh
  tcsh
  ksh (korn)
  bash (bourn again shell)GPL
  zsh 
  ...... 

二.Base Shell相关
1>.GNU Bourne
-Again Shell(bash)是GNU计划中重要的工具软件之一,目前也是 Linux标准的shell,与sh兼容,CentOS默认使用Bash。
2>.显示当前使用的shell [root@node101.yinzhengjie.org.cn
~]# echo ${SHELL} /bin/bash [root@node101.yinzhengjie.org.cn ~]# 3>.显示当前系统使用的所有shell [root@node101.yinzhengjie.org.cn ~]# cat /etc/shells /bin/sh /bin/bash   /usr/bin/sh   /usr/bin/bash   /bin/tcsh   /bin/csh   [root@node101.yinzhengjie.org.cn ~]# 4>.主机名示例:   [root@node101.yinzhengjie.org.cn ~]# cat /etc/hostname   bj-jiuxianqiao-k8s-node101.yinzhengjie.org.cn   [root@node101.yinzhengjie.org.cn ~]#

3>.命令提示符 

1.设置ps1变量的显示

    PS1(是数字1而不是字母l),每个版本bash的PS1变量内的特殊符号可能有些小的差异,你可以先man bash 一下。下面是FC4环境下默认的特殊符号所代表的意义:

    \d :代表日期,格式为weekday month date,例如:"Mon Aug 1"

    \H :完整的主机名称。例如:我的机器名称为:fc4.linux,则这个名称就是fc4.linux

    \h :仅取主机的第一个名字,如上例,则为fc4,.linux则被省略

    \t :显示时间为24小时格式,如:HH:MM:SS

    \T :显示时间为12小时格式

    \A :显示时间为24小时格式:HH:MM

    \u :当前用户的账号名称

    \v :BASH的版本信息

    \w :完整的工作目录名称。家目录会以 ~代替

    \W :利用basename取得工作目录名称,所以只会列出最后一个目录

    \# :下达的第几个命令

    \$ :提示字符,如果是root时,提示符为:# ,普通用户则为:$

    默认的PS1内容为: PS1='[\u@\h \W]\$ ' ,所以默认的提示符就是: [root@linux ~]#。
设置ps1变量的显示
设置ps1变量的颜色

我们能够通过配置PS1变量使提示符成为彩色。在PS1中配置字符序列颜色的格式为:
 
    \[\e[F;Bm\]
 
    基本上是夹在 "\e["(转义开方括号)和 "m" 之间数字值。假如指定一个以上的数字代码,则用分号将他们分开。
    
    其中 F 为字体颜色,编号30~37; B 为背景色,编号40~47。
 
    可通过 \e[0m 关闭颜色输出;特别的,当B为1时,将显示加亮加粗的文字,请看下面的颜色表和代码表。
 
    颜色表
    
    前景     背景     颜色
    ---------------------------------------
        黑色
        红色
        绿色
        黄色
        蓝色
        紫色
        青色
        白色
设置ps1变量的颜色
命令提示符:prompt    
  [root@node101.yinzhengjie.org.cn ~]#
     # 管理员     
     $ 普通用户 

显示提示符格式  
  [root@node101.yinzhengjie.org.cn ~]# echo $PS1
  [\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$                     #我推荐使用这种方式
  [root@node101.yinzhengjie.org.cn ~]#


修改提示符格式   
  PS1="\[\e[1;5;41;33m\][\u@\h \W]\\$\[\e[0m\]"                                       #带有闪烁效果的命令行提示      
  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"        #带有时间的命令行提示

修改提示符格式并永久写入配置文件
  我们可用通过修改
"/etc/bashrc"文件中的PS1变量,也可以在"/etc/profile.d/"目录下创建一个"*.sh"的文件名称,将PS1的变量写入即可。     [23:57:28 root@node101.yinzhengjie.org.cn ~]#cat /etc/profile.d/env.sh                      #文件名称我们自定义,但要以为".sh"结尾即可!编写后重新连接shell时立即生效!     PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\H\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"          [23:57:39 root@node101.yinzhengjie.org.cn ~]#

 

五.执行命令

输入命令后回车       
  提请shell程序找到键入命令所对应的可执行程序或代码,并由其分析后提交 给内核分配资源将其运行起来 

在shell中可执行的命令有两类       
  内部命令:
    由shell自带的,而且通过某命令形式提供   
    help 内部命令列表   
    enable cmd 启用内部命令   
    enable –n cmd 禁用内部命令   
    enable –n 查看所有禁用的内部命令       
  外部命令:
    在文件系统路径下有对应的可执行程序文件   
    查看路径:which  -a |--skip-alias ;  whereis 

区别指定的命令是内部或外部命令          
  type COMMAND 

Hash缓存表
  系统初始hash表为空,当外部命令执行时,默认会从PATH路径下寻找该命令,找到后会将这条命令的路径记录到hash表中,当再次使用该命令时,shell解 释器首先会查看hash表,存在将执行之,如果不存在,将会去PATH路径下寻找, 利用hash缓存表可大大提高命令的调用速率

hash常见用法
  hash    显示hash缓存
  hash -l 显示hash缓存,可作为输入使用
  hash -p path name 将命令全路径path起别名为name
  hash -t name 打印缓存中name的路径
  hash -d name 清除name缓存
  hash -r 清除缓存 
[00:12:56 root@node101.yinzhengjie.org.cn ~]#enable             #查看内部命令
enable .
enable :
enable [
enable alias
enable bg
enable bind
enable break
enable builtin
enable caller
enable cd
enable command
enable compgen
enable complete
enable compopt
enable continue
enable declare
enable dirs
enable disown
enable echo
enable enable
enable eval
enable exec
enable exit
enable export
enable false
enable fc
enable fg
enable getopts
enable hash
enable help
enable history
enable jobs
enable kill
enable let
enable local
enable logout
enable mapfile
enable popd
enable printf
enable pushd
enable pwd
enable read
enable readarray
enable readonly
enable return
enable set
enable shift
enable shopt
enable source
enable suspend
enable test
enable times
enable trap
enable true
enable type
enable typeset
enable ulimit
enable umask
enable unalias
enable unset
enable wait
[00:12:58 root@node101.yinzhengjie.org.cn ~]#
[00:12:58 root@node101.yinzhengjie.org.cn ~]#
[00:13:22 root@node101.yinzhengjie.org.cn ~]#ls -l /bin/bash    #内置命令都在bash中提供的。
-rwxr-xr-x. 1 root root 964608 Oct 31  2018 /bin/bash
[00:13:41 root@node101.yinzhengjie.org.cn ~]#
[00:12:56 root@node101.yinzhengjie.org.cn ~]#enable             #查看内部命令
[00:15:29 root@node101.yinzhengjie.org.cn ~]#type hostname      #hostname是一个外部命令,如果是外部命令type会告诉我们其存放路径,内部命令运行速度要比外部命令运行快得多。只不过我们这个时间我们对其感知太差了
hostname is hashed (/usr/bin/hostname)
[00:15:39 root@node101.yinzhengjie.org.cn ~]#
[00:15:40 root@node101.yinzhengjie.org.cn ~]#type echo        #echo是内部命令
echo is a shell builtin
[00:15:47 root@node101.yinzhengjie.org.cn ~]#
[00:17:48 root@node101.yinzhengjie.org.cn ~]#type uname 
uname is /usr/bin/uname
[00:17:57 root@node101.yinzhengjie.org.cn ~]#
[00:17:57 root@node101.yinzhengjie.org.cn ~]#type type
type is a shell builtin
[00:18:04 root@node101.yinzhengjie.org.cn ~]#
[00:15:29 root@node101.yinzhengjie.org.cn ~]#type hostname         #hostname是一个外部命令,如果是外部命令type会告诉我们其存放路径,内部命令运行速度要比外部命令运行快得多。只不过我们这个时间我们对其感知太差了
[00:20:04 root@node101.yinzhengjie.org.cn ~]#echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[00:20:07 root@node101.yinzhengjie.org.cn ~]#
[00:21:11 root@node101.yinzhengjie.org.cn ~]#hash               #显示hash缓存
hits    command
   2    /usr/bin/hostname
   1    /usr/bin/cat
   1    /usr/bin/ls
[00:21:14 root@node101.yinzhengjie.org.cn ~]#
[00:21:11 root@node101.yinzhengjie.org.cn ~]#hash              #显示hash缓存
[00:22:28 root@node101.yinzhengjie.org.cn ~]#hash -l            #显示hash缓存,可作为输入使用
builtin hash -p /usr/bin/hostname hostname
builtin hash -p /usr/bin/cat cat
builtin hash -p /usr/bin/ls ls
[00:22:30 root@node101.yinzhengjie.org.cn ~]#
[00:22:28 root@node101.yinzhengjie.org.cn ~]#hash -l            #显示hash缓存,可作为输入使用
[00:23:50 root@node101.yinzhengjie.org.cn ~]#hash 
hits    command
   2    /usr/bin/hostname
   1    /usr/bin/cat
   1    /usr/bin/ls
[00:23:51 root@node101.yinzhengjie.org.cn ~]#
[00:23:52 root@node101.yinzhengjie.org.cn ~]#hash -r            #清空缓存
[00:23:53 root@node101.yinzhengjie.org.cn ~]#
[00:23:54 root@node101.yinzhengjie.org.cn ~]#hash 
hash: hash table empty
[00:23:54 root@node101.yinzhengjie.org.cn ~]#
[00:23:52 root@node101.yinzhengjie.org.cn ~]#hash -r            #清空缓存
[00:26:27 root@node101.yinzhengjie.org.cn ~]#hash 
hash: hash table empty
[00:26:29 root@node101.yinzhengjie.org.cn ~]#
[00:26:30 root@node101.yinzhengjie.org.cn ~]#uname -r                    #查看内核版本
3.10.0-957.el7.x86_64
[00:26:34 root@node101.yinzhengjie.org.cn ~]#
[00:26:35 root@node101.yinzhengjie.org.cn ~]#hash                       #查看当前缓存
hits    command
   1    /usr/bin/uname
[00:26:36 root@node101.yinzhengjie.org.cn ~]#
[00:26:37 root@node101.yinzhengjie.org.cn ~]#echo $PATH                   #查看系统默认的环境变量
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[00:26:47 root@node101.yinzhengjie.org.cn ~]#
[00:26:48 root@node101.yinzhengjie.org.cn ~]#mv /usr/bin/uname /usr/local/bin/     #我们将uname命令的路径移动到另一个目录中,均在PATH环境变量中
[00:27:01 root@node101.yinzhengjie.org.cn ~]#
[00:27:02 root@node101.yinzhengjie.org.cn ~]#uname -r                    #再次去执行的时候,我们发现报错啦,因为它会直接去hash中查找了文件路径啦,而没有去PATH中去找!
-bash: /usr/bin/uname: No such file or directory
[00:27:33 root@node101.yinzhengjie.org.cn ~]#
[00:27:37 root@node101.yinzhengjie.org.cn ~]#hash -d uname                #由于hash中存在uname的缓存信息,因此我们要将这个缓存删除掉,如果缓存没有,默认就回去PATH中查找
[00:27:45 root@node101.yinzhengjie.org.cn ~]#
[00:27:46 root@node101.yinzhengjie.org.cn ~]#hash
hits    command
   1    /usr/bin/mv
[00:27:48 root@node101.yinzhengjie.org.cn ~]#
[00:27:49 root@node101.yinzhengjie.org.cn ~]#uname -r                    #此时我们再次使用uname查看内核版本,发现好使了
3.10.0-957.el7.x86_64
[00:27:56 root@node101.yinzhengjie.org.cn ~]#
[00:27:56 root@node101.yinzhengjie.org.cn ~]#hash                      #缓存也更新啦~
hits    command
   1    /usr/bin/mv
   1    /usr/local/bin/uname
[00:28:00 root@node101.yinzhengjie.org.cn ~]#
[00:27:37 root@node101.yinzhengjie.org.cn ~]#hash -d uname         #由于hash中存在uname的缓存信息,因此我们要将这个缓存删除掉,如果缓存没有,默认就回去PATH中查找
[00:34:56 root@node101.yinzhengjie.org.cn ~]#help               #内部命令列表
GNU bash, version 4.2.46(2)-release (x86_64-redhat-linux-gnu)
These shell commands are defined internally.  Type `help' to see this list.
Type `help name' to find out more about the function `name'.
Use `info bash' to find out more about the shell in general.
Use `man -k' or `info' to find out more about commands not in this list.

A star (*) next to a name means that the command is disabled.

 job_spec [&]                                            history [-c] [-d offset] [n] or history -anrw [filen>
 (( expression ))                                        if COMMANDS; then COMMANDS; [ elif COMMANDS; then CO>
 . filename [arguments]                                  jobs [-lnprs] [jobspec ...] or jobs -x command [args>
 :                                                       kill [-s sigspec | -n signum | -sigspec] pid | jobsp>
 [ arg... ]                                              let arg [arg ...]
 [[ expression ]]                                        local [option] name[=value] ...
 alias [-p] [name[=value] ... ]                          logout [n]
 bg [job_spec ...]                                       mapfile [-n count] [-O origin] [-s count] [-t] [-u f>
 bind [-lpvsPVS] [-m keymap] [-f filename] [-q name] [>  popd [-n] [+N | -N]
 break [n]                                               printf [-v var] format [arguments]
 builtin [shell-builtin [arg ...]]                       pushd [-n] [+N | -N | dir]
 caller [expr]                                           pwd [-LP]
 case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]...>  read [-ers] [-a array] [-d delim] [-i text] [-n ncha>
 cd [-L|[-P [-e]]] [dir]                                 readarray [-n count] [-O origin] [-s count] [-t] [-u>
 command [-pVv] command [arg ...]                        readonly [-aAf] [name[=value] ...] or readonly -p
 compgen [-abcdefgjksuv] [-o option]  [-A action] [-G >  return [n]
 complete [-abcdefgjksuv] [-pr] [-DE] [-o option] [-A >  select NAME [in WORDS ... ;] do COMMANDS; done
 compopt [-o|+o option] [-DE] [name ...]                 set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg >
 continue [n]                                            shift [n]
 coproc [NAME] command [redirections]                    shopt [-pqsu] [-o] [optname ...]
 declare [-aAfFgilrtux] [-p] [name[=value] ...]          source filename [arguments]
 dirs [-clpv] [+N] [-N]                                  suspend [-f]
 disown [-h] [-ar] [jobspec ...]                         test [expr]
 echo [-neE] [arg ...]                                   time [-p] pipeline
 enable [-a] [-dnps] [-f filename] [name ...]            times
 eval [arg ...]                                          trap [-lp] [[arg] signal_spec ...]
 exec [-cl] [-a name] [command [arguments ...]] [redir>  true
 exit [n]                                                type [-afptP] name [name ...]
 export [-fn] [name[=value] ...] or export -p            typeset [-aAfFgilrtux] [-p] name[=value] ...
 false                                                   ulimit [-SHacdefilmnpqrstuvx] [limit]
 fc [-e ename] [-lnr] [first] [last] or fc -s [pat=rep>  umask [-p] [-S] [mode]
 fg [job_spec]                                           unalias [-a] name [name ...]
 for NAME [in WORDS ... ] ; do COMMANDS; done            unset [-f] [-v] [name ...]
 for (( exp1; exp2; exp3 )); do COMMANDS; done           until COMMANDS; do COMMANDS; done
 function name { COMMANDS ; } or name () { COMMANDS ; >  variables - Names and meanings of some shell variabl>
 getopts optstring name [arg]                            wait [id]
 hash [-lr] [-p pathname] [-dt] [name ...]               while COMMANDS; do COMMANDS; done
 help [-dms] [pattern ...]                               { COMMANDS ; }
[00:34:57 root@node101.yinzhengjie.org.cn ~]#
[00:34:56 root@node101.yinzhengjie.org.cn ~]#help              #内部命令列表
[00:39:03 root@node101.yinzhengjie.org.cn ~]#which echo           #查看程序的运行路径
/usr/bin/echo
[00:39:09 root@node101.yinzhengjie.org.cn ~]#
[00:39:09 root@node101.yinzhengjie.org.cn ~]#whereis echo          #除了查看程序的运行路径,还会列出该程序的帮助文档存放路径
echo: /usr/bin/echo /usr/share/man/man1/echo.1.gz /usr/share/man/man1p/echo.1p.gz
[00:39:14 root@node101.yinzhengjie.org.cn ~]#

 

六.命名别名

1>.显示当前shell进程所有可用的命令别名 

[16:39:10 root@node101.yinzhengjie.org.cn ~]#alias 
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[16:39:12 root@node101.yinzhengjie.org.cn ~]#
[16:39:10 root@node101.yinzhengjie.org.cn ~]#alias                                  #查看别名

2>.定义别名cdnet,其相当于执行命令VALUE(在命令行中定义的别名,仅对当前shell进程有效 )

[16:42:56 root@node101.yinzhengjie.org.cn ~]#alias cdnet='cd /etc/sysconfig/network-scripts/'        #定义一个别名为cdnet,当用户执行"cdnet"指令时,就会去执行"cd /etc/sysconfig/network-script"
[16:43:12 root@node101.yinzhengjie.org.cn ~]#
[16:43:14 root@node101.yinzhengjie.org.cn ~]#alias 
alias cdnet='cd /etc/sysconfig/network-scripts/'                                   #我们发现一旦在命令行中定义了别名会立即生效
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[16:43:18 root@node101.yinzhengjie.org.cn ~]#
[16:43:20 root@node101.yinzhengjie.org.cn ~]#cdnet                                   #我们这里试着执行了一下我们定义的别名"cdnet",发现的确是执行成功啦!
[16:43:25 root@node101.yinzhengjie.org.cn network-scripts]#
[16:43:26 root@node101.yinzhengjie.org.cn network-scripts]#pwd                            #很显然,的确是按照我们的指令去执行的,而且与以前要敲击很多字符的命令现在只需要五个字母就搞定啦!
/etc/sysconfig/network-scripts
[16:43:31 root@node101.yinzhengjie.org.cn network-scripts]#
[16:42:56 root@node101.yinzhengjie.org.cn ~]#alias cdnet='cd /etc/sysconfig/network-scripts/'        #定义一个别名为cdnet,当用户执行"cdnet"指令时,就会去执行"cd /etc/sysconfig/network-script"
[root@node101.yinzhengjie.org.cn ~]# alias cdnet                                    #查看我们定义的指定别名
alias cdnet='cd /etc/sysconfig/network-scripts/'
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# alias cdnet                                   #查看我们定义的指定别名
[root@node101.yinzhengjie.org.cn ~]# type cdnet                                    #不难发现我们定义的cdnet不属于内置命令也不是外部命令,而是一个别名
cdnet is aliased to `cd /etc/sysconfig/network-scripts/'
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# type cdnet                                    #不难发现我们定义的cdnet不属于内置命令也不是外部命令,而是一个别名
[root@node101.yinzhengjie.org.cn ~]# enable                                       #查看内部命令
enable .
enable :
enable [
enable alias
enable bg
enable bind
enable break
enable builtin
enable caller
enable cd
enable command
enable compgen
enable complete
enable compopt
enable continue
enable declare
enable dirs
enable disown
enable echo
enable enable
enable eval
enable exec
enable exit
enable export
enable false
enable fc
enable fg
enable getopts
enable hash
enable help
enable history
enable jobs
enable kill
enable let
enable local
enable logout
enable mapfile
enable popd
enable printf
enable pushd
enable pwd
enable read
enable readarray
enable readonly
enable return
enable set
enable shift
enable shopt
enable source
enable suspend
enable test
enable times
enable trap
enable true
enable type
enable typeset
enable ulimit
enable umask
enable unalias
enable unset
enable wait
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# hostname                                      #查看主机名称,它是一个外部命令
node101.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# alias enable=hostname                              #我们把一个内置命令enable的变量名赋值给hostname命令,观察结果
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# enable                                        #不难发现,我们执行命令时,他竟然显示的时hostname的结果,因此我们可用总结一下Linux命令执行的顺序啦~
node101.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# alias enable=hostname                              #我们把一个内置命令enable的变量名赋值给hostname命令,观察结果
经过之前的学习,以及刚刚学习的alias,我们不难发现命令执行的顺序为:
    1>.检查是否是别名,如果是就执行别名定义的命名;
    2>.如果别名中找不到就查看是否是内部命令,如果是就执行内部命令;
    3>.查看在HASH表中是否存在,如果存在就执行HASH表中的缓存命令;
    4>.如果在上面三种都没有匹配上就去$PATH中查找对应的路径;
    5>.如果以上都找不到命令的话,那就只能抛出"command not found..."这样的提示啦!

3>.如果想让定义别名永久有效,要定义在配置文件中 

[root@node101.yinzhengjie.org.cn ~]# alias 
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# cat .bashrc                 #当前用户为root,我们发现root用户有自己默认的alias别名。
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# vi .bashrc 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cat .bashrc 
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias cdnet='cd /etc/sysconfig/network-scripts/'                  #我们编辑"~/.bashrc"文件,然后添加我们对应的alias。

# Source global definitions
if [ -f /etc/bashrc ]; then                                                   #很显然,在文件的末尾会加载"/etc/bashrc"文件,因此我们可用在该配置文件中定义alias,如果在该文件中定义会对所有用户生效!
    . /etc/bashrc
fi
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# source .bashrc                 #修改配置文件后,想要立即生效的话,得使用source命令或者"."命令进行加载配置文件
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# alias   
alias cdnet='cd /etc/sysconfig/network-scripts/'                   #很显然加载成功啦~
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cat .bashrc                 #当前用户为root,我们发现root用户有自己默认的alias别名。
[root@node101.yinzhengjie.org.cn ~]# tail -2 /etc/bashrc             #我们可用在"/etc/bashrc"配置文件中修改该值,定义相应的别名。但是针对的是操作系统的所有用户
#ADD BY YINZHENGJIE
alias cdnet='cd /etc/sysconfig/network-scripts/'
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# . /etc/bashrc 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# alias 
alias cdnet='cd /etc/sysconfig/network-scripts/'
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# tail -2 /etc/bashrc            #我们可用在"/etc/bashrc"配置文件中修改该值,定义相应的别名。但是针对的是操作系统的所有用户

4>.撤消别名:unalias 

[root@node101.yinzhengjie.org.cn ~]# alias 
alias cdnet='cd /etc/sysconfig/network-scripts/'        #我们发现这里是咱们自定义的别名
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# unalias cdnet        #我们使用该命令就可用删除别名
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# alias             #查看别名是否删除成功啦~
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# unalias cdnet                                  #我们使用该命令就可用删除别名
[root@node101.yinzhengjie.org.cn ~]# alias 
alias cdnet='cd /etc/sysconfig/network-scripts/'
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# unalias -a                                    #取消所有别名,包括默认的别名也会被取消。再命令行执行的话仅对当前终端生效!
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# alias                                       #取消所有的别名后,我们发现再查看定义的别名时,一个都没有啦!
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# unalias -a                                    #取消所有别名,包括默认的别名也会被取消。再命令行执行的话仅对当前终端生效!

5>.如果别名同原命令同名,如果要执行原命令案例

[root@node101.yinzhengjie.org.cn ~]# hostname
node101.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# alias cd=hostname                  #我们知道"cd"命令是切换路径,但是我们却强行把"hostname"命令强行赋值给它
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cd                            #不难发现,此时我们执行"cd"命令它不能执行它之前的切换路径的作用啦
node101.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 'cd' /etc/sysconfig/network-scripts/       #如果我们非要强行执行"cd"原来的命令的话,可用使用单引号将其括起来,然后就可用完成切换的作用啦
[root@node101.yinzhengjie.org.cn /etc/sysconfig/network-scripts]# 
[root@node101.yinzhengjie.org.cn /etc/sysconfig/network-scripts]# 
[root@node101.yinzhengjie.org.cn /etc/sysconfig/network-scripts]# \cd /etc/      #除了上面使用单引号,还可以使用反斜线的方式,执行"cd"原来的意思,即不适用别名的定义的命令
[root@node101.yinzhengjie.org.cn /etc]# 
[root@node101.yinzhengjie.org.cn /etc]# unalias cd                      #处理上面两种方法可用执行"cd"原来的意思,其实我们还可用更干脆的将别名删除即可呀~
[root@node101.yinzhengjie.org.cn /etc]# 
[root@node101.yinzhengjie.org.cn /etc]# cd /root/                      #删除别名后,发现cd命令可用正常执行啦~
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# alias 
alias cdnet='cd /etc/sysconfig/network-scripts/'
alias cp='cp -i'
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias mv='mv -i'
alias rm='rm -i'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'          #我们不难发现,这里有which相应的别名定义。
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# which ls
alias ls='ls --color=auto'
    /usr/bin/ls
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# which --skip-alias ls                         #我们可用跳过所有的别名设置,直接执行which的初始定义
/usr/bin/ls
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# \which  ls                                #当然我们可用用反斜线也是可用的,我们在上面已经介绍过啦
/usr/bin/ls
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 'which'  ls                               #除此之外,我们还可用使用反引号来执行which的原意命令
/usr/bin/ls
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# which --skip-alias ls                         #我们可用跳过所有的别名设置,直接执行which的初始定义

 

七.命令格式 

1>.标准格式

COMMAND [OPTIONS...] [ARGUMENTS...] 

  需要注意的是,"[]"表示可选项,也就是说OPTIONS和ARGUMENTS都可用不存在。

2>.选项[OPTIONS]

  用于启用或关闭命令的某个或某些功能.    
    
  短选项:UNIX 风格选项,-c 例如:-l, -h

  长选项:GNU风格选项,--word 例如:--all, --human

  BSD风格选项: 一个字母,例如:a
[root@node101.yinzhengjie.org.cn ~]# uname -r
3.10.0-957.el7.x86_64
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# id -u
0
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           3.7G        756M        1.3G         24M        1.6G        2.6G
Swap:          3.9G          0B        3.9G
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# fdisk -l

Disk /dev/sda: 536.9 GB, 536870912000 bytes, 1048576000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000b26be

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200  1048575999   523238400   8e  Linux LVM

Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 4160 MB, 4160749568 bytes, 8126464 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-home: 477.9 GB, 477940940800 bytes, 933478400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

[root@node101.yinzhengjie.org.cn ~]# 
短选项案例(说白了就是选项只有一个"-")
[root@node101.yinzhengjie.org.cn ~]# free --si
              total        used        free      shared  buff/cache   available
Mem:        3861512      775308     1377132       25004     1709072     2747452
Swap:       4063228           0     4063228
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ls --all
.                .bash_history  .bashrc  .cshrc   Documents  .ICEauthority         Music     .tcshrc
..               .bash_logout   .cache   .dbus    Downloads  initial-setup-ks.cfg  Pictures  Templates
anaconda-ks.cfg  .bash_profile  .config  Desktop  .esd_auth  .local                Public    Videos
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# which --skip-alias pwd
/usr/bin/pwd
[root@node101.yinzhengjie.org.cn ~]# 
长选项案例(说白了就是选项有两个"-")
[root@node101.yinzhengjie.org.cn ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:be:11:4d brd ff:ff:ff:ff:ff:ff
    inet 172.30.1.101/24 brd 172.30.1.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:febe:114d/64 scope link 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:a9:de:9b brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:a9:de:9b brd ff:ff:ff:ff:ff:ff
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ps aux
USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root          1  0.0  0.1 193832  6904 ?        Ss   Aug02   0:03 /usr/lib/systemd/systemd --switched-root --sys
root          2  0.0  0.0      0     0 ?        S    Aug02   0:00 [kthreadd]
root          3  0.0  0.0      0     0 ?        S    Aug02   0:00 [ksoftirqd/0]
root          5  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/0:0H]
root          7  0.0  0.0      0     0 ?        S    Aug02   0:00 [migration/0]
root          8  0.0  0.0      0     0 ?        S    Aug02   0:00 [rcu_bh]
root          9  0.0  0.0      0     0 ?        S    Aug02   0:02 [rcu_sched]
root         10  0.0  0.0      0     0 ?        S<   Aug02   0:00 [lru-add-drain]
root         11  0.0  0.0      0     0 ?        S    Aug02   0:00 [watchdog/0]
root         12  0.0  0.0      0     0 ?        S    Aug02   0:00 [watchdog/1]
root         13  0.0  0.0      0     0 ?        S    Aug02   0:00 [migration/1]
root         14  0.0  0.0      0     0 ?        S    Aug02   0:00 [ksoftirqd/1]
root         15  0.0  0.0      0     0 ?        S    Aug02   0:01 [kworker/1:0]
root         16  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/1:0H]
root         17  0.0  0.0      0     0 ?        S    Aug02   0:00 [watchdog/2]
root         18  0.0  0.0      0     0 ?        S    Aug02   0:00 [migration/2]
root         19  0.0  0.0      0     0 ?        S    Aug02   0:00 [ksoftirqd/2]
root         21  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/2:0H]
root         22  0.0  0.0      0     0 ?        S    Aug02   0:00 [watchdog/3]
root         23  0.0  0.0      0     0 ?        S    Aug02   0:00 [migration/3]
root         24  0.0  0.0      0     0 ?        S    Aug02   0:00 [ksoftirqd/3]
root         26  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/3:0H]
root         28  0.0  0.0      0     0 ?        S    Aug02   0:00 [kdevtmpfs]
root         29  0.0  0.0      0     0 ?        S<   Aug02   0:00 [netns]
root         30  0.0  0.0      0     0 ?        S    Aug02   0:00 [khungtaskd]
root         31  0.0  0.0      0     0 ?        S<   Aug02   0:00 [writeback]
root         32  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kintegrityd]
root         33  0.0  0.0      0     0 ?        S<   Aug02   0:00 [bioset]
root         34  0.0  0.0      0     0 ?        S<   Aug02   0:00 [bioset]
root         35  0.0  0.0      0     0 ?        S<   Aug02   0:00 [bioset]
root         36  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kblockd]
root         37  0.0  0.0      0     0 ?        S<   Aug02   0:00 [md]
root         38  0.0  0.0      0     0 ?        S<   Aug02   0:00 [edac-poller]
root         39  0.0  0.0      0     0 ?        S<   Aug02   0:00 [watchdogd]
root         40  0.0  0.0      0     0 ?        S    Aug02   0:01 [kworker/2:1]
root         41  0.0  0.0      0     0 ?        S    Aug02   0:00 [kworker/3:1]
root         47  0.0  0.0      0     0 ?        S    Aug02   0:00 [kswapd0]
root         48  0.0  0.0      0     0 ?        SN   Aug02   0:00 [ksmd]
root         49  0.0  0.0      0     0 ?        SN   Aug02   0:00 [khugepaged]
root         50  0.0  0.0      0     0 ?        S<   Aug02   0:00 [crypto]
root         58  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kthrotld]
root         59  0.0  0.0      0     0 ?        S    Aug02   0:00 [kworker/u256:1]
root         60  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kmpath_rdacd]
root         61  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kaluad]
root         62  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kpsmoused]
root         64  0.0  0.0      0     0 ?        S<   Aug02   0:00 [ipv6_addrconf]
root         77  0.0  0.0      0     0 ?        S<   Aug02   0:00 [deferwq]
root        110  0.0  0.0      0     0 ?        S    Aug02   0:00 [kauditd]
root        258  0.0  0.0      0     0 ?        S    Aug02   0:00 [kworker/2:2]
root        601  0.0  0.0      0     0 ?        S    Aug02   0:00 [kworker/3:2]
root       2752  0.0  0.0      0     0 ?        S<   Aug02   0:00 [nfit]
root       2793  0.0  0.0      0     0 ?        S<   Aug02   0:00 [ata_sff]
root       2805  0.0  0.0      0     0 ?        S<   Aug02   0:00 [mpt_poll_0]
root       2821  0.0  0.0      0     0 ?        S<   Aug02   0:00 [mpt/0]
root       3031  0.0  0.0      0     0 ?        S    Aug02   0:00 [scsi_eh_0]
root       3036  0.0  0.0      0     0 ?        S<   Aug02   0:00 [scsi_tmf_0]
root       3163  0.0  0.0      0     0 ?        S    Aug02   0:00 [scsi_eh_1]
root       3196  0.0  0.0      0     0 ?        S<   Aug02   0:00 [scsi_tmf_1]
root       3203  0.0  0.0      0     0 ?        S    Aug02   0:00 [scsi_eh_2]
root       3209  0.0  0.0      0     0 ?        S<   Aug02   0:00 [scsi_tmf_2]
root       3222  0.0  0.0      0     0 ?        S<   Aug02   0:00 [ttm_swap]
root       3227  0.0  0.0      0     0 ?        S    Aug02   0:00 [irq/16-vmwgfx]
root       4254  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kdmflush]
root       4257  0.0  0.0      0     0 ?        S<   Aug02   0:00 [bioset]
root       4270  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kdmflush]
root       4273  0.0  0.0      0     0 ?        S<   Aug02   0:00 [bioset]
root       4290  0.0  0.0      0     0 ?        S<   Aug02   0:00 [bioset]
root       4298  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfsalloc]
root       4299  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs_mru_cache]
root       4307  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-buf/dm-0]
root       4308  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-data/dm-0]
root       4309  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-conv/dm-0]
root       4311  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-cil/dm-0]
root       4312  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-reclaim/dm-]
root       4314  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-log/dm-0]
root       4315  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-eofblocks/d]
root       4316  0.0  0.0      0     0 ?        S    Aug02   0:03 [xfsaild/dm-0]
root       4317  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/0:1H]
root       4390  0.0  0.1  39824  6136 ?        Ss   Aug02   0:00 /usr/lib/systemd/systemd-journald
root       4411  0.0  0.1 192884  5416 ?        Ss   Aug02   0:00 /usr/sbin/lvmetad -f
root       4426  0.0  0.1  49520  6856 ?        Ss   Aug02   0:01 /usr/lib/systemd/systemd-udevd
root       7347  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/u257:0]
root       7350  0.0  0.0      0     0 ?        S<   Aug02   0:00 [hci0]
root       7351  0.0  0.0      0     0 ?        S<   Aug02   0:00 [hci0]
root       7355  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/u257:2]
root       7612  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-buf/sda1]
root       7618  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-data/sda1]
root       7634  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-conv/sda1]
root       7642  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-cil/sda1]
root       7659  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-reclaim/sda]
root       7664  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-log/sda1]
root       7673  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-eofblocks/s]
root       7682  0.0  0.0      0     0 ?        S    Aug02   0:00 [xfsaild/sda1]
root       8644  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kdmflush]
root       8647  0.0  0.0      0     0 ?        S<   Aug02   0:00 [bioset]
root       8654  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-buf/dm-2]
root       8655  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-data/dm-2]
root       8656  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-conv/dm-2]
root       8657  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-cil/dm-2]
root       8658  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-reclaim/dm-]
root       8659  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-log/dm-2]
root       8662  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xfs-eofblocks/d]
root       8663  0.0  0.0      0     0 ?        S    Aug02   0:00 [xfsaild/dm-2]
root       8698  0.0  0.0  62044  1084 ?        S<sl Aug02   0:00 /sbin/auditd
root       8700  0.0  0.0  84552  2968 ?        S<sl Aug02   0:00 /sbin/audispd
root       8702  0.0  0.0  55632  1664 ?        S<   Aug02   0:00 /usr/sbin/sedispatch
root       8703  0.0  0.0      0     0 ?        S<   Aug02   0:00 [rpciod]
root       8704  0.0  0.0      0     0 ?        S<   Aug02   0:00 [xprtiod]
avahi      8731  0.0  0.0  62268  2272 ?        Ss   Aug02   0:00 avahi-daemon: running [node101.local]
root       8732  0.0  0.0  21676  1300 ?        Ss   Aug02   0:05 /usr/sbin/irqbalance --foreground
rpc        8733  0.0  0.0  73648  1376 ?        Ss   Aug02   0:00 /sbin/rpcbind -w
dbus       8734  0.0  0.1  70996  4492 ?        Ssl  Aug02   0:02 /usr/bin/dbus-daemon --system --address=system
avahi      8735  0.0  0.0  62144   396 ?        S    Aug02   0:00 avahi-daemon: chroot helper
rtkit      8737  0.0  0.0 198792  1652 ?        SNsl Aug02   0:01 /usr/libexec/rtkit-daemon
root       8738  0.0  0.0  90392  3204 ?        Ss   Aug02   0:02 /sbin/rngd -f
root       8739  0.0  0.0  24492  2284 ?        Ss   Aug02   0:00 /usr/sbin/smartd -n -q never
root       8740  0.0  0.2 453456  8756 ?        Ssl  Aug02   0:00 /usr/libexec/udisks2/udisksd
root       8741  0.0  0.1 430600  5536 ?        Ssl  Aug02   0:00 /usr/sbin/ModemManager
root       8743  0.0  0.0  26376  1816 ?        Ss   Aug02   0:00 /usr/lib/systemd/systemd-logind
root       8744  0.0  0.1 228048  5620 ?        Ss   Aug02   0:00 /usr/sbin/abrtd -d -s
root       8747  0.0  0.1 225720  4828 ?        Ss   Aug02   0:00 /usr/bin/abrt-watch-log -F Backtrace /var/log/
root       8748  0.0  0.1 225720  4824 ?        Ss   Aug02   0:00 /usr/bin/abrt-watch-log -F BUG: WARNING: at WA
root       8749  0.0  0.0  57512  2816 ?        Ss   Aug02   0:00 /usr/libexec/bluetooth/bluetoothd
polkitd    8750  0.0  0.3 616508 14584 ?        Ssl  Aug02   0:00 /usr/lib/polkit-1/polkitd --no-debug
libstor+   8751  0.0  0.0   8576   828 ?        Ss   Aug02   0:00 /usr/bin/lsmd -d
root       8755  0.0  0.0  16892  1392 ?        SNs  Aug02   0:00 /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_P
root       8757  0.0  0.1 396352  4104 ?        Ssl  Aug02   0:00 /usr/libexec/accounts-daemon
root       8760  0.0  0.1  99568  6116 ?        Ss   Aug02   0:00 /usr/bin/VGAuthService -s
root       8761  0.1  0.1 320028  6744 ?        Ssl  Aug02   0:47 /usr/bin/vmtoolsd
root       8781  0.0  0.0 207828  1476 ?        Ssl  Aug02   0:00 /usr/sbin/gssproxy -D
root       8840  0.0  0.0 115304   956 ?        S    Aug02   0:01 /bin/bash /usr/sbin/ksmtuned
root       8847  0.0  0.7 358192 29180 ?        Ssl  Aug02   0:00 /usr/bin/python -Es /usr/sbin/firewalld --nofo
root       8897  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/2:1H]
root       8907  0.0  0.2 563132  9292 ?        Ssl  Aug02   0:00 /usr/sbin/NetworkManager --no-daemon
root       8937  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/3:1H]
root       9386  0.0  0.1 112756  4324 ?        Ss   Aug02   0:00 /usr/sbin/sshd -D
root       9387  0.0  0.4 573824 19300 ?        Ssl  Aug02   0:06 /usr/bin/python2 -Es /usr/sbin/tuned -l -P
root       9388  0.0  0.1 197880  4208 ?        Ss   Aug02   0:00 /usr/sbin/cupsd -f
root       9391  0.0  0.1 216408  6044 ?        Ssl  Aug02   0:03 /usr/sbin/rsyslogd -n
root       9395  0.0  0.4 1005992 18324 ?       Ssl  Aug02   0:00 /usr/sbin/libvirtd
root       9404  0.0  0.0 126284  1708 ?        Ss   Aug02   0:00 /usr/sbin/crond -n
root       9405  0.0  0.1 481324  4732 ?        Ssl  Aug02   0:00 /usr/sbin/gdm
root       9406  0.0  0.0  25904   948 ?        Ss   Aug02   0:00 /usr/sbin/atd -f
root       9752  0.0  0.0  91628  2244 ?        Ss   Aug02   0:00 /usr/libexec/postfix/master -w
postfix    9761  0.0  0.1  91800  4116 ?        S    Aug02   0:00 qmgr -l -t unix -u
nobody     9777  0.0  0.0  53884  1108 ?        S    Aug02   0:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt
root       9778  0.0  0.0  53856   380 ?        S    Aug02   0:00 /usr/sbin/dnsmasq --conf-file=/var/lib/libvirt
root      10066  0.0  1.2 353632 46528 tty1     Ssl+ Aug02   0:03 /usr/bin/X :0 -background none -noreset -audit
root      10080  0.0  0.1 529260  5456 ?        Sl   Aug02   0:00 gdm-session-worker [pam/gdm-autologin]
root      10086  0.0  0.2 745084  9396 ?        Ssl  Aug02   0:00 /usr/libexec/gnome-session-binary --session gn
root      10095  0.0  0.0  59024   968 ?        S    Aug02   0:00 dbus-launch --sh-syntax --exit-with-session
root      10096  0.0  0.0  69316  2724 ?        Ssl  Aug02   0:00 /usr/bin/dbus-daemon --fork --print-pid 5 --pr
root      10173  0.0  0.1 388644  6004 ?        Sl   Aug02   0:00 /usr/libexec/gvfsd
root      10178  0.0  0.0 417808  3292 ?        Sl   Aug02   0:00 /usr/libexec/gvfsd-fuse /run/user/0/gvfs -f -o
root      10275  0.0  0.0  72312   780 ?        Ss   Aug02   0:00 /usr/bin/ssh-agent /bin/sh -c exec -l /bin/bas
root      10300  0.0  0.0 346752  3696 ?        Sl   Aug02   0:00 /usr/libexec/at-spi-bus-launcher
root      10305  0.0  0.0  68400  2484 ?        Sl   Aug02   0:00 /usr/bin/dbus-daemon --config-file=/usr/share/
root      10308  0.0  0.1 233104  3944 ?        Sl   Aug02   0:00 /usr/libexec/at-spi2-registryd --use-gnome-ses
root      10345  0.0  0.1 317308  4064 ?        SLl  Aug02   0:00 /usr/bin/gnome-keyring-daemon --start --compon
root      10356  0.0  5.3 3690828 205788 ?      Sl   Aug02   0:20 /usr/bin/gnome-shell
root      10363  0.0  0.1 430252  5212 ?        Ssl  Aug02   0:00 /usr/libexec/upowerd
root      10380  0.0  0.0      0     0 ?        S<   Aug02   0:00 [kworker/1:1H]
root      10407  0.0  0.1 452984  5448 ?        Sl   Aug02   0:00 ibus-daemon --xim --panel disable
root      10411  0.0  0.1 375852  5616 ?        Sl   Aug02   0:00 /usr/libexec/ibus-dconf
root      10413  0.0  0.3 464784 13576 ?        Sl   Aug02   0:00 /usr/libexec/ibus-x11 --kill-daemon
root      10418  0.0  0.0 375848  3328 ?        Sl   Aug02   0:00 /usr/libexec/ibus-portal
root      10427  0.0  0.1 364592  4692 ?        Sl   Aug02   0:00 /usr/libexec/xdg-permission-store
root      10430  0.0  0.3 649684 13624 ?        Sl   Aug02   0:00 /usr/libexec/gnome-shell-calendar-server
root      10437  0.0  0.4 1378552 18212 ?       Sl   Aug02   0:00 /usr/libexec/evolution-source-registry
root      10443  0.0  0.7 101566764 27744 ?     Sl   Aug02   0:00 /usr/libexec/goa-daemon
root      10447  0.0  0.0 398376  3796 ?        Ssl  Aug02   0:00 /usr/libexec/boltd
root      10451  0.0  0.0  78560  3348 ?        Ss   Aug02   0:00 /usr/sbin/wpa_supplicant -u -f /var/log/wpa_su
root      10456  0.0  0.2 485256  9724 ?        Sl   Aug02   0:00 /usr/libexec/mission-control-5
root      10462  0.0  0.1 563260  7376 ?        Sl   Aug02   0:00 /usr/libexec/gvfs-udisks2-volume-monitor
root      10471  0.0  0.1 478400  6444 ?        Sl   Aug02   0:00 /usr/libexec/gvfs-afc-volume-monitor
root      10475  0.0  0.2 532056 10548 ?        Sl   Aug02   0:03 /usr/libexec/goa-identity-service
root      10485  0.0  0.0 400568  3636 ?        Sl   Aug02   0:00 /usr/libexec/gvfs-gphoto2-volume-monitor
root      10492  0.0  0.0 391480  3400 ?        Sl   Aug02   0:00 /usr/libexec/gvfs-mtp-volume-monitor
root      10497  0.0  0.0 371444  3140 ?        Sl   Aug02   0:00 /usr/libexec/gvfs-goa-volume-monitor
root      10501  0.0  0.1 412580  7716 ?        Ssl  Aug02   0:00 /usr/libexec/packagekitd
root      10502  0.0  0.4 631612 16664 ?        Sl   Aug02   0:00 /usr/libexec/gsd-power
root      10504  0.0  0.1 438964  5556 ?        Sl   Aug02   0:00 /usr/libexec/gsd-print-notifications
root      10506  0.0  0.0 521548  2944 ?        Sl   Aug02   0:00 /usr/libexec/gsd-rfkill
root      10510  0.0  0.0 374072  2972 ?        Sl   Aug02   0:00 /usr/libexec/gsd-screensaver-proxy
root      10513  0.0  0.1 558852  5176 ?        Sl   Aug02   0:00 /usr/libexec/gsd-sharing
root      10521  0.0  0.1 454840  4740 ?        Sl   Aug02   0:00 /usr/libexec/gsd-sound
root      10525  0.0  0.3 615060 14736 ?        Sl   Aug02   0:00 /usr/libexec/gsd-xsettings
root      10527  0.0  0.3 557420 14096 ?        Sl   Aug02   0:00 /usr/libexec/gsd-wacom
root      10529  0.0  0.1 472036  5036 ?        Sl   Aug02   0:00 /usr/libexec/gsd-smartcard
root      10531  0.0  0.0 456656  3400 ?        Sl   Aug02   0:00 /usr/libexec/gsd-account
root      10542  0.0  0.0 376328  3240 ?        Sl   Aug02   0:00 /usr/libexec/gsd-a11y-settings
root      10545  0.0  0.3 464404 13360 ?        Sl   Aug02   0:00 /usr/libexec/gsd-clipboard
root      10547  0.0  0.4 705780 16588 ?        Sl   Aug02   0:05 /usr/libexec/gsd-color
root      10548  0.0  0.2 545848  8816 ?        Sl   Aug02   0:00 /usr/libexec/gsd-datetime
root      10551  0.0  0.1 463216  3956 ?        Sl   Aug02   0:02 /usr/libexec/gsd-housekeeping
root      10555  0.0  0.1 1285292 7188 ?        S<l  Aug02   0:00 /usr/bin/pulseaudio --start
root      10557  0.0  0.3 614152 13600 ?        Sl   Aug02   0:00 /usr/libexec/gsd-keyboard
root      10560  0.0  0.4 1142844 17444 ?       Sl   Aug02   0:00 /usr/libexec/gsd-media-keys
root      10564  0.0  0.0 376332  3236 ?        Sl   Aug02   0:00 /usr/libexec/gsd-mouse
root      10595  0.0  0.2 608476  9820 ?        Sl   Aug02   0:00 /usr/libexec/gsd-printer
colord    10614  0.0  0.1 419468  6168 ?        Ssl  Aug02   0:00 /usr/libexec/colord
root      10615  0.0  0.0      0     0 ?        S<   Aug02   0:00 [krfcommd]
root      10622  0.0  0.7 1004644 29216 ?       Sl   Aug02   0:00 nautilus-desktop --force
root      10631  0.0  0.1 464652  4520 ?        Sl   Aug02   0:00 /usr/libexec/gvfsd-trash --spawner :1.3 /org/g
root      10643  0.0  0.5 916396 20040 ?        Sl   Aug02   0:00 /usr/libexec/evolution-calendar-factory
root      10646  0.1  0.6 566640 25984 ?        Sl   Aug02   0:47 /usr/bin/vmtoolsd -n vmusr
root      10648  0.0  0.0 273044  3260 ?        Sl   Aug02   0:00 /usr/libexec/gsd-disk-utility-notify
root      10651  0.0  0.2 309884  9704 ?        S    Aug02   0:00 /usr/bin/seapplet
root      10654  0.0  0.4 530008 16580 ?        Sl   Aug02   0:00 abrt-applet
root      10655  0.0  2.4 118651768 96448 ?     Sl   Aug02   0:05 /usr/libexec/gnome-initial-setup --existing-us
root      10658  0.0  1.5 1277332 59040 ?       Sl   Aug02   0:03 /usr/bin/gnome-software --gapplication-service
root      10668  0.0  0.3 668716 15068 ?        SNl  Aug02   0:00 /usr/libexec/tracker-extract
root      10670  0.0  0.4 1143004 17856 ?       Sl   Aug02   0:00 /usr/libexec/evolution-calendar-factory-subpro
root      10672  0.0  0.2 705980 10276 ?        SNl  Aug02   0:00 /usr/libexec/tracker-miner-apps
root      10679  0.0  0.3 649028 13676 ?        SNl  Aug02   0:00 /usr/libexec/tracker-miner-fs
root      10688  0.0  0.3 561752 11832 ?        SNl  Aug02   0:00 /usr/libexec/tracker-miner-user-guides
root      10715  0.0  0.3 525296 12540 ?        Sl   Aug02   0:00 /usr/libexec/tracker-store
root      10726  0.0  0.4 903120 17436 ?        Sl   Aug02   0:00 /usr/libexec/evolution-addressbook-factory
root      10733  0.0  0.0 187384  2876 ?        Sl   Aug02   0:00 /usr/libexec/dconf-service
root      10795  0.0  0.0 302184  3460 ?        Sl   Aug02   0:00 /usr/libexec/ibus-engine-simple
root      10818  0.0  0.5 1119820 21160 ?       Sl   Aug02   0:00 /usr/libexec/evolution-addressbook-factory-sub
root      10859  0.0  0.2 586136  8488 ?        Ssl  Aug02   0:01 /usr/libexec/fwupd/fwupd
root      11710  0.0  0.0 317740  3300 ?        Sl   Aug02   0:00 /usr/libexec/gvfsd-metadata
root      11718  0.0  0.7 735608 28952 ?        Sl   Aug02   0:00 /usr/libexec/gnome-terminal-server
root      11724  0.0  0.0   8532   732 ?        S    Aug02   0:00 gnome-pty-helper
root      11725  0.0  0.0 116328  3008 pts/0    Ss+  Aug02   0:00 bash
root      16291  0.0  0.0      0     0 ?        S    00:20   0:00 [kworker/1:2]
postfix   16570  0.0  0.1  91732  4096 ?        S    00:50   0:00 pickup -l -t unix -u
root      16953  0.0  0.0      0     0 ?        S    01:30   0:00 [kworker/u256:0]
root      17169  0.0  0.1 160848  5608 ?        Ds   01:44   0:00 sshd: root@pts/1
root      17173  0.0  0.0 116360  3128 pts/1    Ss   01:44   0:00 -bash
root      17321  0.0  0.0      0     0 ?        S    01:53   0:00 [kworker/0:0]
root      17381  0.0  0.0      0     0 ?        S    01:59   0:00 [kworker/0:1]
root      17550  0.0  0.0      0     0 ?        S    02:15   0:00 [kworker/0:2]
root      17552  0.0  0.0      0     0 ?        S    02:16   0:00 [kworker/2:0]
root      17553  0.0  0.0      0     0 ?        S    02:16   0:00 [kworker/2:3]
root      17646  0.0  0.0 107952   612 ?        S    02:19   0:00 sleep 60
root      17659  0.0  0.0 155360  1892 pts/1    R+   02:20   0:00 ps aux
[root@node101.yinzhengjie.org.cn ~]# 
BSD风格案例(说白了就是选线没有"-")

3>.参数[ARGUMENTS]

  命令的作用对象,比如文件名,用户名等.

    [root@node101.yinzhengjie.org.cn ~]# file anaconda-ks.cfg 
    anaconda-ks.cfg: ASCII text
    [root@node101.yinzhengjie.org.cn ~]# 
    [root@node101.yinzhengjie.org.cn ~]# id -u yinzhengjie
    1000
    [root@node101.yinzhengjie.org.cn ~]#

4>.注意事项

  多个选项以及多参数和命令之间使用空白字符分隔 
  
  取消和结束命令执行:Ctrl+c,Ctrl+d
  
  多个命令可以用;符号分开
  
  一个命令可以用\分成多行
[root@node101.yinzhengjie.org.cn ~]# bc      #进入计算器工具
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
ibase        #查看输入的进制,发现默认的进制也是10.
10
obase        #查看输出的进制,发现默认的进制也是10.
10
ibase=2
11111111
255
^C          #我们输入"Ctrl + c"强行退出Linux当前进程
(interrupt) Exiting bc.
[root@node101.yinzhengjie.org.cn ~]# 
我们输入"Ctrl + c"强行退出Linux当前进程
[root@node101.yinzhengjie.org.cn ~]# bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
obase=2
123
1111011                            #我们发现如果输入的是"Ctrl +d"的话并不会强制退出,而是正常退出Linux程序
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# logout       #不仅如此,我们输入"Ctrl + d"还可用退出当前终端哟~
Connection closed by foreign host.

Disconnected from remote host(node101.yinzhengjie.org.cn) at 18:34:43.

Type `help' to learn how to use Xshell prompt.
[c:\~]$
输入的是"Ctrl +d"的话并不会强制退出,而是正常退出Linux程序或终端
[root@node101.yinzhengjie.org.cn ~]# free ;hostname;ifconfig                #使用分号可以同时执行多个命令
              total        used        free      shared  buff/cache   available
Mem:        3861512      778336     1371012       25012     1712164     2744272
Swap:       4063228           0     4063228
node101.yinzhengjie.org.cn
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.30.1.101  netmask 255.255.255.0  broadcast 172.30.1.255
        inet6 fe80::20c:29ff:febe:114d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:be:11:4d  txqueuelen 1000  (Ethernet)
        RX packets 195215  bytes 277828290 (264.9 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 20084  bytes 1539884 (1.4 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 84  bytes 9156 (8.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 84  bytes 9156 (8.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:a9:de:9b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# free ;hostname;ifconfig                #使用分号可以同时执行多个命令
[root@node101.yinzhengjie.org.cn ~]# host\                           #我们可以"\"进行换行,尤其是在编译按照http,nginx等之类的服务,配置参数太多了,一行往往写不下。我这里为了方便演示,就把hostname命令分成2行写啦!
> name
node101.yinzhengjie.org.cn
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# host\                           #我们可以"\"进行换行,尤其是在编译按照http,nginx等之类的服务,配置参数太多了,一行往往写不下。我这里为了方便演示,就把hostname命令分成2行写啦!

 

八.获得帮助

获取帮助的能力决定了技术的能力! 

多层次的帮助 
  whatis 
  help command    #内部命令查看帮助
  command --help  #外部命令查看帮助   
man and info   /usr/share/doc/   Red Hat documentation   其它网站和搜索

1>.whatis

  显示命令的简短描述,可以对命令进行简单说明的。 
  whatis是需要使用数据库的,我们查看命令的简短帮助信息其实是使用的Linux操作系统内置的数据库。 
  刚安装后不可立即使用,因为数据库还没有生成(这个数据库是系统自动生成的,时间是不确定的,它在操作系统不繁忙的时候会自动生成该数据库),我们可以通过makewhatis(CentOS 6 可用)或者mandb(Centos 7 可用)来手动制作数据库 
  使用示例:   
    [root@node101.yinzhengjie.org.cn ~]# whatis rm
    rm (1) - remove files or directories
    rm (1p) - remove directory entries
    [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# mandb 
Purging old database entries in /usr/share/man...
mandb: warning: /usr/share/man/man8/fsck.fat.8.manpage-fix.gz: ignoring bogus filename
Processing manual pages under /usr/share/man...
Purging old database entries in /usr/share/man/uk...
Processing manual pages under /usr/share/man/uk...
Purging old database entries in /usr/share/man/hu...
Processing manual pages under /usr/share/man/hu...
Purging old database entries in /usr/share/man/de...
Processing manual pages under /usr/share/man/de...
Purging old database entries in /usr/share/man/ja...
Processing manual pages under /usr/share/man/ja...
Purging old database entries in /usr/share/man/fr...
Processing manual pages under /usr/share/man/fr...
Purging old database entries in /usr/share/man/ko...
Processing manual pages under /usr/share/man/ko...
Purging old database entries in /usr/share/man/pl...
Processing manual pages under /usr/share/man/pl...
Purging old database entries in /usr/share/man/ru...
Processing manual pages under /usr/share/man/ru...
Purging old database entries in /usr/share/man/sk...
Processing manual pages under /usr/share/man/sk...
Purging old database entries in /usr/share/man/cs...
Processing manual pages under /usr/share/man/cs...
Purging old database entries in /usr/share/man/da...
Processing manual pages under /usr/share/man/da...
Purging old database entries in /usr/share/man/id...
Processing manual pages under /usr/share/man/id...
Purging old database entries in /usr/share/man/it...
Processing manual pages under /usr/share/man/it...
Purging old database entries in /usr/share/man/pt_BR...
Processing manual pages under /usr/share/man/pt_BR...
Purging old database entries in /usr/share/man/sv...
Processing manual pages under /usr/share/man/sv...
Purging old database entries in /usr/share/man/tr...
Processing manual pages under /usr/share/man/tr...
Purging old database entries in /usr/share/man/zh_CN...
Processing manual pages under /usr/share/man/zh_CN...
Purging old database entries in /usr/share/man/zh_TW...
Processing manual pages under /usr/share/man/zh_TW...
Purging old database entries in /usr/share/man/ca...
Processing manual pages under /usr/share/man/ca...
Purging old database entries in /usr/share/man/es...
Processing manual pages under /usr/share/man/es...
Purging old database entries in /usr/share/man/nl...
Processing manual pages under /usr/share/man/nl...
Purging old database entries in /usr/share/man/pt...
Processing manual pages under /usr/share/man/pt...
Purging old database entries in /usr/share/man/overrides...
Processing manual pages under /usr/share/man/overrides...
Purging old database entries in /usr/share/man/en...
Processing manual pages under /usr/share/man/en...
Purging old database entries in /usr/local/share/man...
Processing manual pages under /usr/local/share/man...
0 man subdirectories contained newer manual pages.
0 manual pages were added.
0 stray cats were added.
0 old database entries were purged.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# mandb
[root@node101.yinzhengjie.org.cn ~]# whatis date
date (1)             - print or set the system date and time
date (1p)            - write the date and time
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# whatis date

2>.内部命令的帮助信息

[root@node101.yinzhengjie.org.cn ~]# type help                            #不难发现,help命令本身就是内部命令
help is a shell builtin
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# type echo                            #不难发现,使用type命令可以查看到echo命令是内部命令
echo is a shell builtin
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# type date                            #而date命令不是内部命令,而是外部命令
date is hashed (/usr/bin/date)
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# help date                            #我们使用help命令是没有办法去查看外部命令的帮助信息的
-bash: help: no help topics match `date'.  Try `help help' or `man -k date' or `info date'.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# help echo                               #不难总结出help命令只能用来查看内部命令哟~
echo: echo [-neE] [arg ...]                                          #这里是echo命令的格式
    Write arguments to the standard output.                                #写参数到标准输出,说白了就是把参数输出到当前屏幕中。
    
    Display the ARGs on the standard output followed by a newline.                  #它会显示参数到标准输出并换行。
    
    Options:      #选项
      -n    do not append a newline                                     #不添加换行,默认是在参数结尾换行。
      -e    enable interpretation of the following backslash escapes                 #启用"\"字符的解释功能
      -E    explicitly suppress interpretation of backslash escapes                  #(默认)不支持"\"解释功能
    
    `echo' interprets the following backslash-escaped characters:
      \a    alert (bell)                                            #操作系统会发出警告声
      \b    backspace                                               #退格键,如果后面有数据的话会删除前面一个字符
      \c    suppress further output                                        #最后不加上换行符,可以取消换行,和-n效果类似
      \e    escape character                                           #escape,相当于\033
      \f    form feed                                               #和纵向制表符类似
      \n    new line                                               #添加换行,换行且将光标移至行首
      \r    carriage return                                             #回车,即将光标移至行首,但不换行
      \t    horizontal tab                                            #制表符,一般为4个连续的空格
      \v    vertical tab                                             #纵向的制表符
      \\    backslash                                               #我们知道"\"时转义符,想要打印反斜线的话,就得使用转义符。
      \0nnn    the character whose ASCII code is NNN (octal).  NNN can be to 3 octal digits            #插入nnn(八进制)所代表的ASCII字符
      \xHH    the eight-bit character whose value is HH (hexadecimal).  HH can be one or two hex digits     #插入HH(十六进制)所代表的ASCII数字
    
    Exit Status:
    Returns success unless a write error occurs.
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "\a"        #执行该命令时,你会发现你的服务器如果有声卡的话会发出一个提示音!!!

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "\a"            #执行该命令时,你会发现你的服务器如果有声卡的话会发出一个提示音!!!
[root@node101.yinzhengjie.org.cn ~]# echo -e "abc\bxyz"     #我们发现字符c被删除啦
abxyz
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "abc\bxyz"         #我们发现字符c被删除啦
[root@node101.yinzhengjie.org.cn ~]# echo -e "abc\c"       #我们不难发现,默认的换行符被取消啦!
abc[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "abc\c"           #我们不难发现,默认的换行符被取消啦!
[root@node101.yinzhengjie.org.cn ~]# echo -e "abc\n123\nxyz"    #注意,这里有2个换行符
abc
123
xyz
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "abc\n123\nxyz"      #注意,这里有2个换行符
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\t2019\tjason"      #让字符之间距离间隔一个制表符
yinzhengjie    2019    jason
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\t2019\tjason"      #让字符之间距离间隔一个制表符
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\v2019\vjason"          #我们可以使用纵向的制表符,我们发现数据本来应该连续写的,但是使用纵向制表符后,数据竟然换换行且未到行的首部!
yinzhengjie
           2019
               jason
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\v2019\vjason" | wc -l     #我们使用换行的命令统计改行的大小,返现其仅为1行内容。
1
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\v2019\vjason"          #我们可以使用纵向的制表符,我们发现数据本来应该连续写的,但是使用纵向制表符后,数据竟然换换行且未到行的首部!
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\f2019\ejason" 
yinzhengjie
           2019ason
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\f2019\ejason"
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\f2019\fjason" 
yinzhengjie
           2019
               jason
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\f2019\fjason"
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\r2019"               #不难发现,我们进行回车后,之前的数据被覆盖掉啦,因为我没有换行,直接将光标移至行首了,新数据会把之前的数据覆盖!
2019hengjie
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "yinzhengjie\r2019"               #不难发现,我们进行回车后,之前的数据被覆盖掉啦,因为我没有换行,直接将光标移至行首了,新数据会把之前的数据覆盖!
[root@node101.yinzhengjie.org.cn ~]# echo -e "\\"             #打印反斜线
\
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "\\"             #打印反斜线
[root@node101.yinzhengjie.org.cn ~]# echo -e "\0101"          #使用8进制的方式查看101数字对应的字符
A
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "\0102"
B
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "\0103"
C
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "\0101"           #使用8进制的方式查看101数字对应的字符
[root@node101.yinzhengjie.org.cn ~]# echo -e "\x41"           #使用16进制查看数字41对应的字符
A
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "\x42"
B
[root@node101.yinzhengjie.org.cn ~]# echo -e "\x43"
C
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo -e "\x41"           #使用16进制查看数字41对应的字符
ASCII码:
  计算机内部,所有信息最终都是一个二进制值。上个世纪60年代,美国制定了一套字符编码,对英语字符与二进制位之间的关系,做了统一规定。 ASCII码一共规定了128个字符的编码,占用了一个字节的后面7位,最前面的一位统一规定为0 

Unicode:
  用于表示世界上所有语言中的所有字符。每一个符号都给予一个独一无二的编码数字,Unicode是一个很大的集合,现在的规模可以容纳100多万个符号。Unicode仅仅只是一个字符集,规定了每个字符对应的二进制代码,至于这个二进制代码如何存储则没有规定 

Unicode编码方案:(我们可以形象的比喻,Unicode编码只是告诉全世界这个字该怎么写,但是以哪种方式编码它推出了以下几种解决方案,尽管你使用的时GBK或者UTF-8编码,但是在内存中的数据均是万国码Unicode。)  
  UTF-8:变长,1到4个字节  
  UTF-16:变长,2或4个字节  
  UTF-32:固定长度,4个字节 

UTF-8编码 
  是目前互联网上使用最广泛的一种Unicode编码方式,可变长存储。使用 1 - 4 个字节表示一个字符,根据字符的不同变换长度。编码规则如下: 
    对于单个字节的字符,第一位设为0,后面的7位对应这个字符的Unicode码。因此,对于英文中的0 - 127号字符,与ASCII码完全相同。这意味着ASCII码的文档可用UTF-8编码打开 
    对于需要使用N个字节来表示的字符(N>1),第一个字节的前N位都设为1,第“N+1”位设为0,剩余的“N-1”个字节的前两位都设位10,剩下的二进制位则使用这个字符的Unicode码来填充 

编码转换和查询:  
  http://www.chi2ko.com/tool/CJK.htm  
  https://javawind.net/tools/native2ascii.jsp?action=transform  
  http://tool.oschina.net/encode   

Linux系统查看当前操作系统正在使用的编码方法如下:
  [root@node101.yinzhengjie.org.cn ~]# echo $LANG
  en_US.UTF-8
  [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# man ascii
ASCII(7)                                             Linux Programmer's Manual                                             ASCII(7)

NAME
       ascii - ASCII character set encoded in octal, decimal, and hexadecimal

DESCRIPTION
       ASCII is the American Standard Code for Information Interchange.  It is a 7-bit code.  Many 8-bit codes (such as ISO 8859-1,
       the Linux default character set) contain ASCII as their lower half.  The international counterpart of ASCII is known as  ISO
       646.

       The following table contains the 128 ASCII characters.

       C program '\X' escapes are noted.

       Oct   Dec   Hex   Char                        Oct   Dec   Hex   Char
       ────────────────────────────────────────────────────────────────────────
       000   0     00    NUL '\0'                    100   64    40    @
       001   1     01    SOH (start of heading)      101   65    41    A
       002   2     02    STX (start of text)         102   66    42    B
       003   3     03    ETX (end of text)           103   67    43    C
       004   4     04    EOT (end of transmission)   104   68    44    D
       005   5     05    ENQ (enquiry)               105   69    45    E
       006   6     06    ACK (acknowledge)           106   70    46    F
       007   7     07    BEL '\a' (bell)             107   71    47    G
       010   8     08    BS  '\b' (backspace)        110   72    48    H
       011   9     09    HT  '\t' (horizontal tab)   111   73    49    I
       012   10    0A    LF  '\n' (new line)         112   74    4A    J
       013   11    0B    VT  '\v' (vertical tab)     113   75    4B    K
       014   12    0C    FF  '\f' (form feed)        114   76    4C    L
       015   13    0D    CR  '\r' (carriage ret)     115   77    4D    M
       016   14    0E    SO  (shift out)             116   78    4E    N
       017   15    0F    SI  (shift in)              117   79    4F    O
       020   16    10    DLE (data link escape)      120   80    50    P
       021   17    11    DC1 (device control 1)      121   81    51    Q
       022   18    12    DC2 (device control 2)      122   82    52    R
       023   19    13    DC3 (device control 3)      123   83    53    S
       024   20    14    DC4 (device control 4)      124   84    54    T
       025   21    15    NAK (negative ack.)         125   85    55    U
       026   22    16    SYN (synchronous idle)      126   86    56    V
       027   23    17    ETB (end of trans. blk)     127   87    57    W
       030   24    18    CAN (cancel)                130   88    58    X
       031   25    19    EM  (end of medium)         131   89    59    Y
       032   26    1A    SUB (substitute)            132   90    5A    Z
       033   27    1B    ESC (escape)                133   91    5B    [
       034   28    1C    FS  (file separator)        134   92    5C    \  '\\'
       035   29    1D    GS  (group separator)       135   93    5D    ]
       036   30    1E    RS  (record separator)      136   94    5E    ^
       037   31    1F    US  (unit separator)        137   95    5F    _
       040   32    20    SPACE                       140   96    60    `
       041   33    21    !                           141   97    61    a
       042   34    22    "                           142   98    62    b
       043   35    23    #                           143   99    63    c
       044   36    24    $                           144   100   64    d
       045   37    25    %                           145   101   65    e
       046   38    26    &                           146   102   66    f
       047   39    27    ´                           147   103   67    g
       050   40    28    (                           150   104   68    h
       051   41    29    )                           151   105   69    i
       052   42    2A    *                           152   106   6A    j
       053   43    2B    +                           153   107   6B    k
       054   44    2C    ,                           154   108   6C    l
       055   45    2D    -                           155   109   6D    m
       056   46    2E    .                           156   110   6E    n

       057   47    2F    /                           157   111   6F    o
       060   48    30    0                           160   112   70    p
       061   49    31    1                           161   113   71    q
       062   50    32    2                           162   114   72    r
       063   51    33    3                           163   115   73    s
       064   52    34    4                           164   116   74    t
       065   53    35    5                           165   117   75    u
       066   54    36    6                           166   118   76    v
       067   55    37    7                           167   119   77    w
       070   56    38    8                           170   120   78    x
       071   57    39    9                           171   121   79    y
       072   58    3A    :                           172   122   7A    z
       073   59    3B    ;                           173   123   7B    {
       074   60    3C    <                           174   124   7C    |
       075   61    3D    =                           175   125   7D    }
       076   62    3E    >                           176   126   7E    ~
       077   63    3F    ?                           177   127   7F    DEL

   Tables
       For convenience, let us give more compact tables in hex and decimal.

          2 3 4 5 6 7       30 40 50 60 70 80 90 100 110 120
        -------------      ---------------------------------
       0:   0 @ P ` p     0:    (  2  <  F  P  Z  d   n   x
       1: ! 1 A Q a q     1:    )  3  =  G  Q  [  e   o   y
       2: " 2 B R b r     2:    *  4  >  H  R  \  f   p   z
       3: # 3 C S c s     3: !  +  5  ?  I  S  ]  g   q   {
       4: $ 4 D T d t     4: "  ,  6  @  J  T  ^  h   r   |
       5: % 5 E U e u     5: #  -  7  A  K  U  _  i   s   }
       6: & 6 F V f v     6: $  .  8  B  L  V  `  j   t   ~
       7: ´ 7 G W g w     7: %  /  9  C  M  W  a  k   u  DEL
       8: ( 8 H X h x     8: &  0  :  D  N  X  b  l   v
       9: ) 9 I Y i y     9: ´  1  ;  E  O  Y  c  m   w
       A: * : J Z j z
       B: + ; K [ k {
       C: , < L \ l |
       D: - = M ] m }
       E: . > N ^ n ~
       F: / ? O _ o DEL

NOTES
   History
       An ascii manual page appeared in Version 7 of AT&T UNIX.

       On  older  terminals,  the  underscore code is displayed as a left arrow, called backarrow, the caret is displayed as an up-
       arrow and the vertical bar has a hole in the middle.

       Uppercase and lowercase characters differ by just one bit and the ASCII character 2 differs from the double  quote  by  just
       one  bit,  too.   That  made it much easier to encode characters mechanically or with a non-microcontroller-based electronic
       keyboard and that pairing was found on old teletypes.

       The ASCII standard was published by the United States of America Standards Institute (USASI) in 1968.

SEE ALSO
       iso_8859-1(7), iso_8859-10(7), iso_8859-13(7), iso_8859-14(7), iso_8859-15(7), iso_8859-16(7), iso_8859-2(7), iso_8859-3(7),
       iso_8859-4(7), iso_8859-5(7), iso_8859-6(7), iso_8859-7(7), iso_8859-8(7), iso_8859-9(7)

COLOPHON
       This page is part of release 3.53 of the Linux man-pages project.  A description of the project, and information about
       reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.

Linux                                                        2009-02-12                                                    ASCII(7)
[root@node101.yinzhengjie.org.cn ~]# man ascii
[root@node101.yinzhengjie.org.cn ~]# file a.txt           #不难发现我们的文件内容为ASCII编码
a.txt: ASCII text
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cat a.txt 
abc123
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# hexdump a.txt 
0000000 6261 3163 3332 000a                    
0000007
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# hexdump -C a.txt 
00000000  61 62 63 31 32 33 0a                              |abc123.|
00000007
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# file a.txt           #不难发现我们的文件内容为ASCII编码
[root@node101.yinzhengjie.org.cn ~]# file b.txt            #由于我写的文件包含中文,因此Linux的文件编码格式默认为UTF-8。
b.txt: UTF-8 Unicode text
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cat b.txt 
尹正杰
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# hexdump -C b.txt         #不难发现一般情况下,一个汉字对应着3个字节。
00000000  e5 b0 b9 e6 ad a3 e6 9d  b0 0a                    |..........|
0000000a
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# hexdump  b.txt          
0000000 b0e5 e6b9 a3ad 9de6 0ab0               
000000a
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# file b.txt            #由于我写的文件包含中文,因此Linux的文件编码格式默认为UTF-8。
#!/usr/bin/env python
#_*_conding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie


print("尹正杰".encode())
print("尹正杰".encode().hex())


"""
以上代码输出结果如下:
    b'\xe5\xb0\xb9\xe6\xad\xa3\xe6\x9d\xb0'
    e5b0b9e6ada3e69db0

根据结果进行分析:
    ""的Unicode码为:"\xe5\xb0\xb9",需要3个字节存储,转换成16进制为:"e5b0b9",转换成2进制(得出Unicode编码)为:"11100101 10110000 10111001"
    ""的Unicode码为:"\xe6\xad\xa3",也需要3个字节存储,转换16进制为:"e6ada3",转换成2进制(得出Unicode编码)为:"11100110 10101101 10100011"
    ""的Unicode码为:"\xe6\x9d\xb0",还是需要3个字节存储,转换成16进制为:"e69db0",转换成2进制(得出Unicode编码)为:"11100110 10011101 10110000"
"""
Unicode和UTF-8示例
[root@node101.yinzhengjie.org.cn ~]# iconv -l                #Linux查看支持的字符集
The following list contain all the coded character sets known.  This does
not necessarily mean that all combinations of these names can be used for
the FROM and TO command line parameters.  One coded character set can be
listed with several different names (aliases).

  437, 500, 500V1, 850, 851, 852, 855, 856, 857, 860, 861, 862, 863, 864, 865,
  866, 866NAV, 869, 874, 904, 1026, 1046, 1047, 8859_1, 8859_2, 8859_3, 8859_4,
  8859_5, 8859_6, 8859_7, 8859_8, 8859_9, 10646-1:1993, 10646-1:1993/UCS4,
  ANSI_X3.4-1968, ANSI_X3.4-1986, ANSI_X3.4, ANSI_X3.110-1983, ANSI_X3.110,
  ARABIC, ARABIC7, ARMSCII-8, ASCII, ASMO-708, ASMO_449, BALTIC, BIG-5,
  BIG-FIVE, BIG5-HKSCS, BIG5, BIG5HKSCS, BIGFIVE, BRF, BS_4730, CA, CN-BIG5,
  CN-GB, CN, CP-AR, CP-GR, CP-HU, CP037, CP038, CP273, CP274, CP275, CP278,
  CP280, CP281, CP282, CP284, CP285, CP290, CP297, CP367, CP420, CP423, CP424,
  CP437, CP500, CP737, CP770, CP771, CP772, CP773, CP774, CP775, CP803, CP813,
  CP819, CP850, CP851, CP852, CP855, CP856, CP857, CP860, CP861, CP862, CP863,
  CP864, CP865, CP866, CP866NAV, CP868, CP869, CP870, CP871, CP874, CP875,
  CP880, CP891, CP901, CP902, CP903, CP904, CP905, CP912, CP915, CP916, CP918,
  CP920, CP921, CP922, CP930, CP932, CP933, CP935, CP936, CP937, CP939, CP949,
  CP950, CP1004, CP1008, CP1025, CP1026, CP1046, CP1047, CP1070, CP1079,
  CP1081, CP1084, CP1089, CP1097, CP1112, CP1122, CP1123, CP1124, CP1125,
  CP1129, CP1130, CP1132, CP1133, CP1137, CP1140, CP1141, CP1142, CP1143,
  CP1144, CP1145, CP1146, CP1147, CP1148, CP1149, CP1153, CP1154, CP1155,
  CP1156, CP1157, CP1158, CP1160, CP1161, CP1162, CP1163, CP1164, CP1166,
  CP1167, CP1250, CP1251, CP1252, CP1253, CP1254, CP1255, CP1256, CP1257,
  CP1258, CP1282, CP1361, CP1364, CP1371, CP1388, CP1390, CP1399, CP4517,
  CP4899, CP4909, CP4971, CP5347, CP9030, CP9066, CP9448, CP10007, CP12712,
  CP16804, CPIBM861, CSA7-1, CSA7-2, CSASCII, CSA_T500-1983, CSA_T500,
  CSA_Z243.4-1985-1, CSA_Z243.4-1985-2, CSA_Z243.419851, CSA_Z243.419852,
  CSDECMCS, CSEBCDICATDE, CSEBCDICATDEA, CSEBCDICCAFR, CSEBCDICDKNO,
  CSEBCDICDKNOA, CSEBCDICES, CSEBCDICESA, CSEBCDICESS, CSEBCDICFISE,
  CSEBCDICFISEA, CSEBCDICFR, CSEBCDICIT, CSEBCDICPT, CSEBCDICUK, CSEBCDICUS,
  CSEUCKR, CSEUCPKDFMTJAPANESE, CSGB2312, CSHPROMAN8, CSIBM037, CSIBM038,
  CSIBM273, CSIBM274, CSIBM275, CSIBM277, CSIBM278, CSIBM280, CSIBM281,
  CSIBM284, CSIBM285, CSIBM290, CSIBM297, CSIBM420, CSIBM423, CSIBM424,
  CSIBM500, CSIBM803, CSIBM851, CSIBM855, CSIBM856, CSIBM857, CSIBM860,
  CSIBM863, CSIBM864, CSIBM865, CSIBM866, CSIBM868, CSIBM869, CSIBM870,
  CSIBM871, CSIBM880, CSIBM891, CSIBM901, CSIBM902, CSIBM903, CSIBM904,
  CSIBM905, CSIBM918, CSIBM921, CSIBM922, CSIBM930, CSIBM932, CSIBM933,
  CSIBM935, CSIBM937, CSIBM939, CSIBM943, CSIBM1008, CSIBM1025, CSIBM1026,
  CSIBM1097, CSIBM1112, CSIBM1122, CSIBM1123, CSIBM1124, CSIBM1129, CSIBM1130,
  CSIBM1132, CSIBM1133, CSIBM1137, CSIBM1140, CSIBM1141, CSIBM1142, CSIBM1143,
  CSIBM1144, CSIBM1145, CSIBM1146, CSIBM1147, CSIBM1148, CSIBM1149, CSIBM1153,
  CSIBM1154, CSIBM1155, CSIBM1156, CSIBM1157, CSIBM1158, CSIBM1160, CSIBM1161,
  CSIBM1163, CSIBM1164, CSIBM1166, CSIBM1167, CSIBM1364, CSIBM1371, CSIBM1388,
  CSIBM1390, CSIBM1399, CSIBM4517, CSIBM4899, CSIBM4909, CSIBM4971, CSIBM5347,
  CSIBM9030, CSIBM9066, CSIBM9448, CSIBM12712, CSIBM16804, CSIBM11621162,
  CSISO4UNITEDKINGDOM, CSISO10SWEDISH, CSISO11SWEDISHFORNAMES,
  CSISO14JISC6220RO, CSISO15ITALIAN, CSISO16PORTUGESE, CSISO17SPANISH,
  CSISO18GREEK7OLD, CSISO19LATINGREEK, CSISO21GERMAN, CSISO25FRENCH,
  CSISO27LATINGREEK1, CSISO49INIS, CSISO50INIS8, CSISO51INISCYRILLIC,
  CSISO58GB1988, CSISO60DANISHNORWEGIAN, CSISO60NORWEGIAN1, CSISO61NORWEGIAN2,
  CSISO69FRENCH, CSISO84PORTUGUESE2, CSISO85SPANISH2, CSISO86HUNGARIAN,
  CSISO88GREEK7, CSISO89ASMO449, CSISO90, CSISO92JISC62991984B, CSISO99NAPLPS,
  CSISO103T618BIT, CSISO111ECMACYRILLIC, CSISO121CANADIAN1, CSISO122CANADIAN2,
  CSISO139CSN369103, CSISO141JUSIB1002, CSISO143IECP271, CSISO150,
  CSISO150GREEKCCITT, CSISO151CUBA, CSISO153GOST1976874, CSISO646DANISH,
  CSISO2022CN, CSISO2022JP, CSISO2022JP2, CSISO2022KR, CSISO2033,
  CSISO5427CYRILLIC, CSISO5427CYRILLIC1981, CSISO5428GREEK, CSISO10367BOX,
  CSISOLATIN1, CSISOLATIN2, CSISOLATIN3, CSISOLATIN4, CSISOLATIN5, CSISOLATIN6,
  CSISOLATINARABIC, CSISOLATINCYRILLIC, CSISOLATINGREEK, CSISOLATINHEBREW,
  CSKOI8R, CSKSC5636, CSMACINTOSH, CSNATSDANO, CSNATSSEFI, CSN_369103,
  CSPC8CODEPAGE437, CSPC775BALTIC, CSPC850MULTILINGUAL, CSPC862LATINHEBREW,
  CSPCP852, CSSHIFTJIS, CSUCS4, CSUNICODE, CSWINDOWS31J, CUBA, CWI-2, CWI,
  CYRILLIC, DE, DEC-MCS, DEC, DECMCS, DIN_66003, DK, DS2089, DS_2089, E13B,
  EBCDIC-AT-DE-A, EBCDIC-AT-DE, EBCDIC-BE, EBCDIC-BR, EBCDIC-CA-FR,
  EBCDIC-CP-AR1, EBCDIC-CP-AR2, EBCDIC-CP-BE, EBCDIC-CP-CA, EBCDIC-CP-CH,
  EBCDIC-CP-DK, EBCDIC-CP-ES, EBCDIC-CP-FI, EBCDIC-CP-FR, EBCDIC-CP-GB,
  EBCDIC-CP-GR, EBCDIC-CP-HE, EBCDIC-CP-IS, EBCDIC-CP-IT, EBCDIC-CP-NL,
  EBCDIC-CP-NO, EBCDIC-CP-ROECE, EBCDIC-CP-SE, EBCDIC-CP-TR, EBCDIC-CP-US,
  EBCDIC-CP-WT, EBCDIC-CP-YU, EBCDIC-CYRILLIC, EBCDIC-DK-NO-A, EBCDIC-DK-NO,
  EBCDIC-ES-A, EBCDIC-ES-S, EBCDIC-ES, EBCDIC-FI-SE-A, EBCDIC-FI-SE, EBCDIC-FR,
  EBCDIC-GREEK, EBCDIC-INT, EBCDIC-INT1, EBCDIC-IS-FRISS, EBCDIC-IT,
  EBCDIC-JP-E, EBCDIC-JP-KANA, EBCDIC-PT, EBCDIC-UK, EBCDIC-US, EBCDICATDE,
  EBCDICATDEA, EBCDICCAFR, EBCDICDKNO, EBCDICDKNOA, EBCDICES, EBCDICESA,
  EBCDICESS, EBCDICFISE, EBCDICFISEA, EBCDICFR, EBCDICISFRISS, EBCDICIT,
  EBCDICPT, EBCDICUK, EBCDICUS, ECMA-114, ECMA-118, ECMA-128, ECMA-CYRILLIC,
  ECMACYRILLIC, ELOT_928, ES, ES2, EUC-CN, EUC-JISX0213, EUC-JP-MS, EUC-JP,
  EUC-KR, EUC-TW, EUCCN, EUCJP-MS, EUCJP-OPEN, EUCJP-WIN, EUCJP, EUCKR, EUCTW,
  FI, FR, GB, GB2312, GB13000, GB18030, GBK, GB_1988-80, GB_198880,
  GEORGIAN-ACADEMY, GEORGIAN-PS, GOST_19768-74, GOST_19768, GOST_1976874,
  GREEK-CCITT, GREEK, GREEK7-OLD, GREEK7, GREEK7OLD, GREEK8, GREEKCCITT,
  HEBREW, HP-GREEK8, HP-ROMAN8, HP-ROMAN9, HP-THAI8, HP-TURKISH8, HPGREEK8,
  HPROMAN8, HPROMAN9, HPTHAI8, HPTURKISH8, HU, IBM-803, IBM-856, IBM-901,
  IBM-902, IBM-921, IBM-922, IBM-930, IBM-932, IBM-933, IBM-935, IBM-937,
  IBM-939, IBM-943, IBM-1008, IBM-1025, IBM-1046, IBM-1047, IBM-1097, IBM-1112,
  IBM-1122, IBM-1123, IBM-1124, IBM-1129, IBM-1130, IBM-1132, IBM-1133,
  IBM-1137, IBM-1140, IBM-1141, IBM-1142, IBM-1143, IBM-1144, IBM-1145,
  IBM-1146, IBM-1147, IBM-1148, IBM-1149, IBM-1153, IBM-1154, IBM-1155,
  IBM-1156, IBM-1157, IBM-1158, IBM-1160, IBM-1161, IBM-1162, IBM-1163,
  IBM-1164, IBM-1166, IBM-1167, IBM-1364, IBM-1371, IBM-1388, IBM-1390,
  IBM-1399, IBM-4517, IBM-4899, IBM-4909, IBM-4971, IBM-5347, IBM-9030,
  IBM-9066, IBM-9448, IBM-12712, IBM-16804, IBM037, IBM038, IBM256, IBM273,
  IBM274, IBM275, IBM277, IBM278, IBM280, IBM281, IBM284, IBM285, IBM290,
  IBM297, IBM367, IBM420, IBM423, IBM424, IBM437, IBM500, IBM775, IBM803,
  IBM813, IBM819, IBM848, IBM850, IBM851, IBM852, IBM855, IBM856, IBM857,
  IBM860, IBM861, IBM862, IBM863, IBM864, IBM865, IBM866, IBM866NAV, IBM868,
  IBM869, IBM870, IBM871, IBM874, IBM875, IBM880, IBM891, IBM901, IBM902,
  IBM903, IBM904, IBM905, IBM912, IBM915, IBM916, IBM918, IBM920, IBM921,
  IBM922, IBM930, IBM932, IBM933, IBM935, IBM937, IBM939, IBM943, IBM1004,
  IBM1008, IBM1025, IBM1026, IBM1046, IBM1047, IBM1089, IBM1097, IBM1112,
  IBM1122, IBM1123, IBM1124, IBM1129, IBM1130, IBM1132, IBM1133, IBM1137,
  IBM1140, IBM1141, IBM1142, IBM1143, IBM1144, IBM1145, IBM1146, IBM1147,
  IBM1148, IBM1149, IBM1153, IBM1154, IBM1155, IBM1156, IBM1157, IBM1158,
  IBM1160, IBM1161, IBM1162, IBM1163, IBM1164, IBM1166, IBM1167, IBM1364,
  IBM1371, IBM1388, IBM1390, IBM1399, IBM4517, IBM4899, IBM4909, IBM4971,
  IBM5347, IBM9030, IBM9066, IBM9448, IBM12712, IBM16804, IEC_P27-1, IEC_P271,
  INIS-8, INIS-CYRILLIC, INIS, INIS8, INISCYRILLIC, ISIRI-3342, ISIRI3342,
  ISO-2022-CN-EXT, ISO-2022-CN, ISO-2022-JP-2, ISO-2022-JP-3, ISO-2022-JP,
  ISO-2022-KR, ISO-8859-1, ISO-8859-2, ISO-8859-3, ISO-8859-4, ISO-8859-5,
  ISO-8859-6, ISO-8859-7, ISO-8859-8, ISO-8859-9, ISO-8859-9E, ISO-8859-10,
  ISO-8859-11, ISO-8859-13, ISO-8859-14, ISO-8859-15, ISO-8859-16,
  ISO-10646-UCS-2, ISO-10646, ISO-10646/UCS2, ISO-10646/UCS4, ISO-10646/UTF-8,
  ISO-10646/UTF8, ISO-CELTIC, ISO-IR-4, ISO-IR-6, ISO-IR-8-1, ISO-IR-9-1,
  ISO-IR-10, ISO-IR-11, ISO-IR-14, ISO-IR-15, ISO-IR-16, ISO-IR-17, ISO-IR-18,
  ISO-IR-19, ISO-IR-21, ISO-IR-25, ISO-IR-27, ISO-IR-37, ISO-IR-49, ISO-IR-50,
  ISO-IR-51, ISO-IR-54, ISO-IR-55, ISO-IR-57, ISO-IR-60, ISO-IR-61, ISO-IR-69,
  ISO-IR-84, ISO-IR-85, ISO-IR-86, ISO-IR-88, ISO-IR-89, ISO-IR-90, ISO-IR-92,
  ISO-IR-98, ISO-IR-99, ISO-IR-100, ISO-IR-101, ISO-IR-103, ISO-IR-109,
  ISO-IR-110, ISO-IR-111, ISO-IR-121, ISO-IR-122, ISO-IR-126, ISO-IR-127,
  ISO-IR-138, ISO-IR-139, ISO-IR-141, ISO-IR-143, ISO-IR-144, ISO-IR-148,
  ISO-IR-150, ISO-IR-151, ISO-IR-153, ISO-IR-155, ISO-IR-156, ISO-IR-157,
  ISO-IR-166, ISO-IR-179, ISO-IR-193, ISO-IR-197, ISO-IR-199, ISO-IR-203,
  ISO-IR-209, ISO-IR-226, ISO/TR_11548-1, ISO646-CA, ISO646-CA2, ISO646-CN,
  ISO646-CU, ISO646-DE, ISO646-DK, ISO646-ES, ISO646-ES2, ISO646-FI, ISO646-FR,
  ISO646-FR1, ISO646-GB, ISO646-HU, ISO646-IT, ISO646-JP-OCR-B, ISO646-JP,
  ISO646-KR, ISO646-NO, ISO646-NO2, ISO646-PT, ISO646-PT2, ISO646-SE,
  ISO646-SE2, ISO646-US, ISO646-YU, ISO2022CN, ISO2022CNEXT, ISO2022JP,
  ISO2022JP2, ISO2022KR, ISO6937, ISO8859-1, ISO8859-2, ISO8859-3, ISO8859-4,
  ISO8859-5, ISO8859-6, ISO8859-7, ISO8859-8, ISO8859-9, ISO8859-9E,
  ISO8859-10, ISO8859-11, ISO8859-13, ISO8859-14, ISO8859-15, ISO8859-16,
  ISO11548-1, ISO88591, ISO88592, ISO88593, ISO88594, ISO88595, ISO88596,
  ISO88597, ISO88598, ISO88599, ISO88599E, ISO885910, ISO885911, ISO885913,
  ISO885914, ISO885915, ISO885916, ISO_646.IRV:1991, ISO_2033-1983, ISO_2033,
  ISO_5427-EXT, ISO_5427, ISO_5427:1981, ISO_5427EXT, ISO_5428, ISO_5428:1980,
  ISO_6937-2, ISO_6937-2:1983, ISO_6937, ISO_6937:1992, ISO_8859-1,
  ISO_8859-1:1987, ISO_8859-2, ISO_8859-2:1987, ISO_8859-3, ISO_8859-3:1988,
  ISO_8859-4, ISO_8859-4:1988, ISO_8859-5, ISO_8859-5:1988, ISO_8859-6,
  ISO_8859-6:1987, ISO_8859-7, ISO_8859-7:1987, ISO_8859-7:2003, ISO_8859-8,
  ISO_8859-8:1988, ISO_8859-9, ISO_8859-9:1989, ISO_8859-9E, ISO_8859-10,
  ISO_8859-10:1992, ISO_8859-14, ISO_8859-14:1998, ISO_8859-15,
  ISO_8859-15:1998, ISO_8859-16, ISO_8859-16:2001, ISO_9036, ISO_10367-BOX,
  ISO_10367BOX, ISO_11548-1, ISO_69372, IT, JIS_C6220-1969-RO,
  JIS_C6229-1984-B, JIS_C62201969RO, JIS_C62291984B, JOHAB, JP-OCR-B, JP, JS,
  JUS_I.B1.002, KOI-7, KOI-8, KOI8-R, KOI8-RU, KOI8-T, KOI8-U, KOI8, KOI8R,
  KOI8U, KSC5636, L1, L2, L3, L4, L5, L6, L7, L8, L10, LATIN-9, LATIN-GREEK-1,
  LATIN-GREEK, LATIN1, LATIN2, LATIN3, LATIN4, LATIN5, LATIN6, LATIN7, LATIN8,
  LATIN9, LATIN10, LATINGREEK, LATINGREEK1, MAC-CENTRALEUROPE, MAC-CYRILLIC,
  MAC-IS, MAC-SAMI, MAC-UK, MAC, MACCYRILLIC, MACINTOSH, MACIS, MACUK,
  MACUKRAINIAN, MIK, MS-ANSI, MS-ARAB, MS-CYRL, MS-EE, MS-GREEK, MS-HEBR,
  MS-MAC-CYRILLIC, MS-TURK, MS932, MS936, MSCP949, MSCP1361, MSMACCYRILLIC,
  MSZ_7795.3, MS_KANJI, NAPLPS, NATS-DANO, NATS-SEFI, NATSDANO, NATSSEFI,
  NC_NC0010, NC_NC00-10, NC_NC00-10:81, NF_Z_62-010, NF_Z_62-010_(1973),
  NF_Z_62-010_1973, NF_Z_62010, NF_Z_62010_1973, NO, NO2, NS_4551-1, NS_4551-2,
  NS_45511, NS_45512, OS2LATIN1, OSF00010001, OSF00010002, OSF00010003,
  OSF00010004, OSF00010005, OSF00010006, OSF00010007, OSF00010008, OSF00010009,
  OSF0001000A, OSF00010020, OSF00010100, OSF00010101, OSF00010102, OSF00010104,
  OSF00010105, OSF00010106, OSF00030010, OSF0004000A, OSF0005000A, OSF05010001,
  OSF100201A4, OSF100201A8, OSF100201B5, OSF100201F4, OSF100203B5, OSF1002011C,
  OSF1002011D, OSF1002035D, OSF1002035E, OSF1002035F, OSF1002036B, OSF1002037B,
  OSF10010001, OSF10010004, OSF10010006, OSF10020025, OSF10020111, OSF10020115,
  OSF10020116, OSF10020118, OSF10020122, OSF10020129, OSF10020352, OSF10020354,
  OSF10020357, OSF10020359, OSF10020360, OSF10020364, OSF10020365, OSF10020366,
  OSF10020367, OSF10020370, OSF10020387, OSF10020388, OSF10020396, OSF10020402,
  OSF10020417, PT, PT2, PT154, R8, R9, RK1048, ROMAN8, ROMAN9, RUSCII, SE, SE2,
  SEN_850200_B, SEN_850200_C, SHIFT-JIS, SHIFT_JIS, SHIFT_JISX0213, SJIS-OPEN,
  SJIS-WIN, SJIS, SS636127, STRK1048-2002, ST_SEV_358-88, T.61-8BIT, T.61,
  T.618BIT, TCVN-5712, TCVN, TCVN5712-1, TCVN5712-1:1993, THAI8, TIS-620,
  TIS620-0, TIS620.2529-1, TIS620.2533-0, TIS620, TS-5881, TSCII, TURKISH8,
  UCS-2, UCS-2BE, UCS-2LE, UCS-4, UCS-4BE, UCS-4LE, UCS2, UCS4, UHC, UJIS, UK,
  UNICODE, UNICODEBIG, UNICODELITTLE, US-ASCII, US, UTF-7, UTF-8, UTF-16,
  UTF-16BE, UTF-16LE, UTF-32, UTF-32BE, UTF-32LE, UTF7, UTF8, UTF16, UTF16BE,
  UTF16LE, UTF32, UTF32BE, UTF32LE, VISCII, WCHAR_T, WIN-SAMI-2, WINBALTRIM,
  WINDOWS-31J, WINDOWS-874, WINDOWS-936, WINDOWS-1250, WINDOWS-1251,
  WINDOWS-1252, WINDOWS-1253, WINDOWS-1254, WINDOWS-1255, WINDOWS-1256,
  WINDOWS-1257, WINDOWS-1258, WINSAMI2, WS2, YU
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# iconv -l                #Linux查看支持的字符集
[root@node101.yinzhengjie.org.cn ~]# man 7 charsets
CHARSETS(7)                                          Linux Programmer's Manual                                          CHARSETS(7)

NAME
       charsets - character set standards and internationalization

DESCRIPTION
       This  manual  page  gives  an  overview  on different character set standards and how they were used on Linux before Unicode
       became ubiquitous.  Some of this information is still helpful for people working with legacy systems and documents.

       Standards discussed include such as ASCII, GB 2312, ISO 8859, JIS, KOI8-R, KS, and Unicode.

       The primary emphasis is on character sets that were actually used by locale character sets, not the myriad others that could
       be found in data from other systems.

       The recommended encoding in all settings and locales is UTF-8.

   ASCII
       ASCII  (American  Standard  Code  For  Information Interchange) is the original 7-bit character set, originally designed for
       American English.  Also known as US-ASCII.  It is currently described by the ISO 646:1991 IRV (International Reference  Ver‐
       sion) standard.

       Various  ASCII  variants  replacing  the  dollar sign with other currency symbols and replacing punctuation with non-English
       alphabetic characters to cover German, French, Spanish, and others in 7 bits emerged.  All are deprecated;  glibc  does  not
       support locales whose character sets are not true supersets of ASCII.

       As Unicode, when using UTF-8, is ASCII-compatible, plain ASCII text still renders properly on modern UTF-8 using systems.

   ISO 8859
       ISO  8859 is a series of 15 8-bit character sets, all of which have ASCII in their low (7-bit) half, invisible control char‐
       acters in positions 128 to 159, and 96 fixed-width graphics in positions 160-255.

       Of these, the most important is ISO 8859-1 ("Latin Alphabet No .1" / Latin-1).  It was widely adopted and supported by  dif‐
       ferent  systems,  and is gradually being replaced with Unicode.  The ISO 8859-1 characters are also the first 256 characters
       of Unicode.

       Console support for the other 8859 character sets is available under Linux through user-mode utilities (such as  setfont(8))
       that modify keyboard bindings and the EGA graphics table and employ the "user mapping" font table in the console driver.

       Here are brief descriptions of each set:

       8859-1 (Latin-1)
              Latin-1  covers many West European languages such as Albanian, Basque, Danish, English, Faroese, Galician, Icelandic,
              Irish, Italian, Norwegian, Portuguese, Spanish, and Swedish.  The lack of the ligatures Dutch IJ/ij, French œ, and old-
              style „German“ quotation marks was considered tolerable.

       8859-2 (Latin-2)
              Latin-2  supports  many  Latin-written  Central and East European languages such as Bosnian, Croatian, Czech, German,
              Hungarian, Polish, Slovak, and Slovene.  Replacing Romanian ș/ț with ş/ţ was considered tolerable.

       8859-3 (Latin-3)
              Latin-3 was designed to cover of Esperanto, Maltese, and Turkish, but 8859-9 later superseded it for Turkish.
       8859-4 (Latin-4)
              Latin-4 introduced letters for North European languages such as Estonian, Latvian, and Lithuanian, but was superseded
              by 8859-10 and 8859-13.

       8859-5 Cyrillic letters supporting Bulgarian, Byelorussian, Macedonian, Russian, Serbian, and (almost completely) Ukrainian.
              It was never widely used, see the discussion of KOI8-R/KOI8-U below.

       8859-6 Was created for Arabic.  The 8859-6 glyph table is a fixed font of separate letter forms, but a proper display engine
              should combine these using the proper initial, medial, and final forms.

       8859-7 Was created for Modern Greek in 1987, updated in 2003.

       8859-8 Supports  Modern  Hebrew  without niqud (punctuation signs).  Niqud and full-fledged Biblical Hebrew were outside the
              scope of this character set.

       8859-9 (Latin-5)
              This is a variant of Latin-1 that replaces Icelandic letters with Turkish ones.

       8859-10 (Latin-6)
              Latin-6 added the Inuit (Greenlandic) and Sami (Lappish) letters that were missing in Latin-4  to  cover  the  entire
              Nordic area.

       8859-11
              Supports the Thai alphabet and is nearly identical to the TIS-620 standard.

       8859-12
              This set does not exist.

       8859-13 (Latin-7)
              Supports the Baltic Rim languages; in particular, it includes Latvian characters not found in Latin-4.

       8859-14 (Latin-8)
              This is the Celtic character set, covering Old Irish, Manx, Gaelic, Welsh, Cornish, and Breton.

       8859-15 (Latin-9)
              Latin-9 is similar to the widely used Latin-1 but replaces some less common symbols with the Euro sign and French and
              Finnish letters that were missing in Latin-1.

       8859-16 (Latin-10)
              This set covers many Southeast European languages, and  most  importantly  supports  Romanian  more  completely  than
              Latin-2.

   KOI8-R / KOI8-U
       KOI8-R  is a non-ISO character set popular in Russia before Unicode.  The lower half is ASCII; the upper is a Cyrillic char‐
       acter set somewhat better designed than ISO 8859-5.  KOI8-U, based on KOI8-R, has better support for Ukrainian.  Neither  of
       these sets are ISO-2022 compatible, unlike the ISO 8859 series.

       Console  support  for  KOI8-R is available under Linux through user-mode utilities that modify keyboard bindings and the EGA
       graphics table, and employ the "user mapping" font table in the console driver.

   GB 2312
       GB 2312 is a mainland Chinese national standard character set used to express simplified Chinese.  Just  like  JIS  X  0208,
       characters  are  mapped  into  a  94x94 two-byte matrix used to construct EUC-CN.  EUC-CN is the most important encoding for
       Linux and includes ASCII and GB 2312.  Note that EUC-CN is often called as GB, GB 2312, or CN-GB.

   Big5
       Big5 was a popular character set in Taiwan to express traditional Chinese.  (Big5 is both a character set and an  encoding.)
       It  is a superset of ASCII.  Non-ASCII characters are expressed in two bytes.  Bytes 0xa1-0xfe are used as leading bytes for
       two-byte characters.  Big5 and its extension were widely used in Taiwan and Hong Kong.  It is not ISO 2022 compliant.

   JIS X 0208
       JIS X 0208 is a Japanese national standard character set.  Though there are some more Japanese national  standard  character
       sets (like JIS X 0201, JIS X 0212, and JIS X 0213), this is the most important one.  Characters are mapped into a 94x94 two-
       byte matrix, whose each byte is in the range 0x21-0x7e.  Note that JIS X 0208 is a character set,  not  an  encoding.   This
       means that JIS X 0208 itself is not used for expressing text data.  JIS X 0208 is used as a component to construct encodings
       such as EUC-JP, Shift_JIS, and ISO-2022-JP.  EUC-JP is the most important encoding for Linux and includes ASCII  and  JIS  X
       0208.  In EUC-JP, JIS X 0208 characters are expressed in two bytes, each of which is the JIS X 0208 code plus 0x80.

   KS X 1001
       KS  X  1001  is  a  Korean national standard character set.  Just as JIS X 0208, characters are mapped into a 94x94 two-byte
       matrix.  KS X 1001 is used like JIS X 0208, as a component to construct encodings such as EUC-KR,  Johab,  and  ISO-2022-KR.
       EUC-KR is the most important encoding for Linux and includes ASCII and KS X 1001.  KS C 5601 is an older name for KS X 1001.

   ISO 2022 and ISO 4873
       The  ISO 2022 and 4873 standards describe a font-control model based on VT100 practice.  This model is (partially) supported
       by the Linux kernel and by xterm(1).  Several ISO 2022-based character encodings have been defined, especially for Japanese.

       There are 4 graphic character sets, called G0, G1, G2, and G3, and one of them is the current character set for  codes  with
       xx=B, and ESC ) xx, ESC * xx, ESC + xx are equivalent to ESC - xx, ESC . xx, ESC / xx, respectively.

   TIS-620
       TIS-620 is a Thai national standard character set and a superset of ASCII.  In the same fashion as the ISO 8859 series, Thai
       characters are mapped into 0xa1-0xfe.

   Unicode
       Unicode  (ISO 10646) is a standard which aims to unambiguously represent every character in every human language.  Unicode's
       structure permits 20.1 bits to encode every character.  Since most computers don't include  20.1-bit  integers,  Unicode  is
       usually  encoded  as 32-bit integers internally and either a series of 16-bit integers (UTF-16) (needing two 16-bit integers
       only when encoding certain rare characters) or a series of 8-bit bytes (UTF-8).

       Linux represents Unicode using the 8-bit Unicode Transformation Format (UTF-8).  UTF-8 is a variable length encoding of Uni‐
       code.   It uses 1 byte to code 7 bits, 2 bytes for 11 bits, 3 bytes for 16 bits, 4 bytes for 21 bits, 5 bytes for 26 bits, 6
       bytes for 31 bits.

       Let 0,1,x stand for a zero, one, or arbitrary bit.  A byte 0xxxxxxx stands for the Unicode 00000000 0xxxxxxx which codes the
       same  symbol  as  the  ASCII 0xxxxxxx.  Thus, ASCII goes unchanged into UTF-8, and people using only ASCII do not notice any
       change: not in code, and not in file size.

       A byte 110xxxxx is the start of a 2-byte code, and 110xxxxx 10yyyyyy is assembled into 00000xxx xxyyyyyy.  A  byte  1110xxxx
       is  the  start of a 3-byte code, and 1110xxxx 10yyyyyy 10zzzzzz is assembled into xxxxyyyy yyzzzzzz.  (When UTF-8 is used to
       code the 31-bit ISO 10646 then this progression continues up to 6-byte codes.)

       For most texts in ISO 8859 character sets, this means that the characters outside of ASCII are now  coded  with  two  bytes.
       This tends to expand ordinary text files by only one or two percent.  For Russian or Greek texts, this expands ordinary text
       files by 100%, since text in those languages is mostly outside of ASCII.  For Japanese users  this  means  that  the  16-bit codes.

       Note  that  UTF-8  is  self-synchronizing: 10xxxxxx is a tail, any other byte is the head of a code.  Note that the only way
       ASCII bytes occur in a UTF-8 stream, is as themselves.  In particular, there are no embedded NULs ('\0') or '/'s  that  form
       part of some larger code.

       Since  ASCII,  and, in particular, NUL and '/', are unchanged, the kernel does not notice that UTF-8 is being used.  It does
       not care at all what the bytes it is handling stand for.

       Rendering of Unicode data streams is typically handled through "subfont" tables which map a subset  of  Unicode  to  glyphs.
       Internally  the  kernel  uses  Unicode to describe the subfont loaded in video RAM.  This means that in the Linux console in
       UTF-8 mode, one can use a character set with 512 different symbols.  This is not enough for Japanese, Chinese,  and  Korean,
       but it is enough for most other purposes.

SEE ALSO
       iconv(1), ascii(7), iso_8859-1(7), unicode(7), utf-8(7)

Linux                                                        2014-08-19                                                 CHARSETS(7)
[root@node101.yinzhengjie.org.cn ~]# man 7 charsets            #查看各个字符集的详细信息
[root@node101.yinzhengjie.org.cn ~]# localectl list-locales         #查看当前操作系统支持的语言
aa_DJ
aa_DJ.iso88591
aa_DJ.utf8
aa_ER
aa_ER.utf8
aa_ER.utf8@saaho
aa_ER@saaho
aa_ET
aa_ET.utf8
af_ZA
af_ZA.iso88591
af_ZA.utf8
am_ET
am_ET.utf8
an_ES
an_ES.iso885915
an_ES.utf8
ar_AE
ar_AE.iso88596
ar_AE.utf8
ar_BH
ar_BH.iso88596
ar_BH.utf8
ar_DZ
ar_DZ.iso88596
ar_DZ.utf8
ar_EG
ar_EG.iso88596
ar_EG.utf8
ar_IN
ar_IN.utf8
ar_IQ
ar_IQ.iso88596
ar_IQ.utf8
ar_JO
ar_JO.iso88596
ar_JO.utf8
ar_KW
ar_KW.iso88596
ar_KW.utf8
ar_LB
ar_LB.iso88596
ar_LB.utf8
ar_LY
ar_LY.iso88596
ar_LY.utf8
ar_MA
ar_MA.iso88596
ar_MA.utf8
ar_OM
ar_OM.iso88596
ar_OM.utf8
ar_QA
ar_QA.iso88596
ar_QA.utf8
ar_SA
ar_SA.iso88596
ar_SA.utf8
ar_SD
ar_SD.iso88596
ar_SD.utf8
ar_SY
ar_SY.iso88596
ar_SY.utf8
ar_TN
ar_TN.iso88596
ar_TN.utf8
ar_YE
ar_YE.iso88596
ar_YE.utf8
as_IN
as_IN.utf8
ast_ES
ast_ES.iso885915
ast_ES.utf8
ayc_PE
ayc_PE.utf8
az_AZ
az_AZ.utf8
be_BY
be_BY.cp1251
be_BY.utf8
be_BY.utf8@latin
be_BY@latin
bem_ZM
bem_ZM.utf8
ber_DZ
ber_DZ.utf8
ber_MA
ber_MA.utf8
bg_BG
bg_BG.cp1251
bg_BG.utf8
bho_IN
bho_IN.utf8
bn_BD
bn_BD.utf8
bn_IN
bn_IN.utf8
bo_CN
bo_CN.utf8
bo_IN
bo_IN.utf8
bokmal
br_FR
br_FR.iso88591
br_FR.iso885915@euro
br_FR.utf8
br_FR@euro
brx_IN
brx_IN.utf8
bs_BA
bs_BA.iso88592
bs_BA.utf8
byn_ER
byn_ER.utf8
ca_AD
ca_AD.iso885915
ca_AD.utf8
ca_ES
ca_ES.iso88591
ca_ES.iso885915@euro
ca_ES.utf8
ca_ES@euro
ca_FR
ca_FR.iso885915
ca_FR.utf8
ca_IT
ca_IT.iso885915
ca_IT.utf8
catalan
crh_UA
crh_UA.utf8
croatian
cs_CZ
cs_CZ.iso88592
cs_CZ.utf8
csb_PL
csb_PL.utf8
cv_RU
cv_RU.utf8
cy_GB
cy_GB.iso885914
cy_GB.utf8
czech
da_DK
da_DK.iso88591
da_DK.iso885915
da_DK.utf8
danish
dansk
de_AT
de_AT.iso88591
de_AT.iso885915@euro
de_AT.utf8
de_AT@euro
de_BE
de_BE.iso88591
de_BE.iso885915@euro
de_BE.utf8
de_BE@euro
de_CH
de_CH.iso88591
de_CH.utf8
de_DE
de_DE.iso88591
de_DE.iso885915@euro
de_DE.utf8
de_DE@euro
de_LU
de_LU.iso88591
de_LU.iso885915@euro
de_LU.utf8
de_LU@euro
deutsch
doi_IN
doi_IN.utf8
dutch
dv_MV
dv_MV.utf8
dz_BT
dz_BT.utf8
eesti
el_CY
el_CY.iso88597
el_CY.utf8
el_GR
el_GR.iso88597
el_GR.iso88597@euro
el_GR.utf8
el_GR@euro
en_AG
en_AG.utf8
en_AU
en_AU.iso88591
en_AU.utf8
en_BW
en_BW.iso88591
en_BW.utf8
en_CA
en_CA.iso88591
en_CA.utf8
en_DK
en_DK.iso88591
en_DK.utf8
en_GB
en_GB.iso88591
en_GB.iso885915
en_GB.utf8
en_HK
en_HK.iso88591
en_HK.utf8
en_IE
en_IE.iso88591
en_IE.iso885915@euro
en_IE.utf8
en_IE@euro
en_IN
en_IN.utf8
en_NG
en_NG.utf8
en_NZ
en_NZ.iso88591
en_NZ.utf8
en_PH
en_PH.iso88591
en_PH.utf8
en_SG
en_SG.iso88591
en_SG.utf8
en_US
en_US.iso88591
en_US.iso885915
en_US.utf8
en_ZA
en_ZA.iso88591
en_ZA.utf8
en_ZM
en_ZM.utf8
en_ZW
en_ZW.iso88591
en_ZW.utf8
es_AR
es_AR.iso88591
es_AR.utf8
es_BO
es_BO.iso88591
es_BO.utf8
es_CL
es_CL.iso88591
es_CL.utf8
es_CO
es_CO.iso88591
es_CO.utf8
es_CR
es_CR.iso88591
es_CR.utf8
es_CU
es_CU.utf8
es_DO
es_DO.iso88591
es_DO.utf8
es_EC
es_EC.iso88591
es_EC.utf8
es_ES
es_ES.iso88591
es_ES.iso885915@euro
es_ES.utf8
es_ES@euro
es_GT
es_GT.iso88591
es_GT.utf8
es_HN
es_HN.iso88591
es_HN.utf8
es_MX
es_MX.iso88591
es_MX.utf8
es_NI
es_NI.iso88591
es_NI.utf8
es_PA
es_PA.iso88591
es_PA.utf8
es_PE
es_PE.iso88591
es_PE.utf8
es_PR
es_PR.iso88591
es_PR.utf8
es_PY
es_PY.iso88591
es_PY.utf8
es_SV
es_SV.iso88591
es_SV.utf8
es_US
es_US.iso88591
es_US.utf8
es_UY
es_UY.iso88591
es_UY.utf8
es_VE
es_VE.iso88591
es_VE.utf8
estonian
et_EE
et_EE.iso88591
et_EE.iso885915
et_EE.utf8
eu_ES
eu_ES.iso88591
eu_ES.iso885915@euro
eu_ES.utf8
eu_ES@euro
fa_IR
fa_IR.utf8
ff_SN
ff_SN.utf8
fi_FI
fi_FI.iso88591
fi_FI.iso885915@euro
fi_FI.utf8
fi_FI@euro
fil_PH
fil_PH.utf8
finnish
fo_FO
fo_FO.iso88591
fo_FO.utf8
fr_BE
fr_BE.iso88591
fr_BE.iso885915@euro
fr_BE.utf8
fr_BE@euro
fr_CA
fr_CA.iso88591
fr_CA.utf8
fr_CH
fr_CH.iso88591
fr_CH.utf8
fr_FR
fr_FR.iso88591
fr_FR.iso885915@euro
fr_FR.utf8
fr_FR@euro
fr_LU
fr_LU.iso88591
fr_LU.iso885915@euro
fr_LU.utf8
fr_LU@euro
french
fur_IT
fur_IT.utf8
fy_DE
fy_DE.utf8
fy_NL
fy_NL.utf8
ga_IE
ga_IE.iso88591
ga_IE.iso885915@euro
ga_IE.utf8
ga_IE@euro
galego
galician
gd_GB
gd_GB.iso885915
gd_GB.utf8
german
gez_ER
gez_ER.utf8
gez_ER.utf8@abegede
gez_ER@abegede
gez_ET
gez_ET.utf8
gez_ET.utf8@abegede
gez_ET@abegede
gl_ES
gl_ES.iso88591
gl_ES.iso885915@euro
gl_ES.utf8
gl_ES@euro
greek
gu_IN
gu_IN.utf8
gv_GB
gv_GB.iso88591
gv_GB.utf8
ha_NG
ha_NG.utf8
he_IL
he_IL.iso88598
he_IL.utf8
hebrew
hi_IN
hi_IN.utf8
hne_IN
hne_IN.utf8
hr_HR
hr_HR.iso88592
hr_HR.utf8
hrvatski
hsb_DE
hsb_DE.iso88592
hsb_DE.utf8
ht_HT
ht_HT.utf8
hu_HU
hu_HU.iso88592
hu_HU.utf8
hungarian
hy_AM
hy_AM.armscii8
hy_AM.utf8
ia_FR
ia_FR.utf8
icelandic
id_ID
id_ID.iso88591
id_ID.utf8
ig_NG
ig_NG.utf8
ik_CA
ik_CA.utf8
is_IS
is_IS.iso88591
is_IS.utf8
it_CH
it_CH.iso88591
it_CH.utf8
it_IT
it_IT.iso88591
it_IT.iso885915@euro
it_IT.utf8
it_IT@euro
italian
iu_CA
iu_CA.utf8
iw_IL
iw_IL.iso88598
iw_IL.utf8
ja_JP
ja_JP.eucjp
ja_JP.ujis
ja_JP.utf8
japanese
japanese.euc
ka_GE
ka_GE.georgianps
ka_GE.utf8
kk_KZ
kk_KZ.pt154
kk_KZ.utf8
kl_GL
kl_GL.iso88591
kl_GL.utf8
km_KH
km_KH.utf8
kn_IN
kn_IN.utf8
ko_KR
ko_KR.euckr
ko_KR.utf8
kok_IN
kok_IN.utf8
korean
korean.euc
ks_IN
ks_IN.utf8
ks_IN.utf8@devanagari
ks_IN@devanagari
ku_TR
ku_TR.iso88599
ku_TR.utf8
kw_GB
kw_GB.iso88591
kw_GB.utf8
ky_KG
ky_KG.utf8
lb_LU
lb_LU.utf8
lg_UG
lg_UG.iso885910
lg_UG.utf8
li_BE
li_BE.utf8
li_NL
li_NL.utf8
lij_IT
lij_IT.utf8
lithuanian
lo_LA
lo_LA.utf8
lt_LT
lt_LT.iso885913
lt_LT.utf8
lv_LV
lv_LV.iso885913
lv_LV.utf8
mag_IN
mag_IN.utf8
mai_IN
mai_IN.utf8
mg_MG
mg_MG.iso885915
mg_MG.utf8
mhr_RU
mhr_RU.utf8
mi_NZ
mi_NZ.iso885913
mi_NZ.utf8
mk_MK
mk_MK.iso88595
mk_MK.utf8
ml_IN
ml_IN.utf8
mn_MN
mn_MN.utf8
mni_IN
mni_IN.utf8
mr_IN
mr_IN.utf8
ms_MY
ms_MY.iso88591
ms_MY.utf8
mt_MT
mt_MT.iso88593
mt_MT.utf8
my_MM
my_MM.utf8
nan_TW.utf8@latin
nan_TW@latin
nb_NO
nb_NO.iso88591
nb_NO.utf8
nds_DE
nds_DE.utf8
nds_NL
nds_NL.utf8
ne_NP
ne_NP.utf8
nhn_MX
nhn_MX.utf8
niu_NU
niu_NU.utf8
niu_NZ
niu_NZ.utf8
nl_AW
nl_AW.utf8
nl_BE
nl_BE.iso88591
nl_BE.iso885915@euro
nl_BE.utf8
nl_BE@euro
nl_NL
nl_NL.iso88591
nl_NL.iso885915@euro
nl_NL.utf8
nl_NL@euro
nn_NO
nn_NO.iso88591
nn_NO.utf8
no_NO
no_NO.ISO-8859-1
norwegian
nr_ZA
nr_ZA.utf8
nso_ZA
nso_ZA.utf8
nynorsk
oc_FR
oc_FR.iso88591
oc_FR.utf8
om_ET
om_ET.utf8
om_KE
om_KE.iso88591
om_KE.utf8
or_IN
or_IN.utf8
os_RU
os_RU.utf8
pa_IN
pa_IN.utf8
pa_PK
pa_PK.utf8
pap_AN
pap_AN.utf8
pl_PL
pl_PL.iso88592
pl_PL.utf8
polish
portuguese
ps_AF
ps_AF.utf8
pt_BR
pt_BR.iso88591
pt_BR.utf8
pt_PT
pt_PT.iso88591
pt_PT.iso885915@euro
pt_PT.utf8
pt_PT@euro
ro_RO
ro_RO.iso88592
ro_RO.utf8
romanian
ru_RU
ru_RU.iso88595
ru_RU.koi8r
ru_RU.utf8
ru_UA
ru_UA.koi8u
ru_UA.utf8
russian
rw_RW
rw_RW.utf8
sa_IN
sa_IN.utf8
sat_IN
sat_IN.utf8
sc_IT
sc_IT.utf8
sd_IN
sd_IN.utf8
sd_IN.utf8@devanagari
sd_IN@devanagari
se_NO
se_NO.utf8
shs_CA
shs_CA.utf8
si_LK
si_LK.utf8
sid_ET
sid_ET.utf8
sk_SK
sk_SK.iso88592
sk_SK.utf8
sl_SI
sl_SI.iso88592
sl_SI.utf8
slovak
slovene
slovenian
so_DJ
so_DJ.iso88591
so_DJ.utf8
so_ET
so_ET.utf8
so_KE
so_KE.iso88591
so_KE.utf8
so_SO
so_SO.iso88591
so_SO.utf8
spanish
sq_AL
sq_AL.iso88591
sq_AL.utf8
sq_MK
sq_MK.utf8
sr_ME
sr_ME.utf8
sr_RS
sr_RS.utf8
sr_RS.utf8@latin
sr_RS@latin
ss_ZA
ss_ZA.utf8
st_ZA
st_ZA.iso88591
st_ZA.utf8
sv_FI
sv_FI.iso88591
sv_FI.iso885915@euro
sv_FI.utf8
sv_FI@euro
sv_SE
sv_SE.iso88591
sv_SE.iso885915
sv_SE.utf8
sw_KE
sw_KE.utf8
sw_TZ
sw_TZ.utf8
swedish
szl_PL
szl_PL.utf8
ta_IN
ta_IN.utf8
ta_LK
ta_LK.utf8
te_IN
te_IN.utf8
tg_TJ
tg_TJ.koi8t
tg_TJ.utf8
th_TH
th_TH.tis620
th_TH.utf8
thai
ti_ER
ti_ER.utf8
ti_ET
ti_ET.utf8
tig_ER
tig_ER.utf8
tk_TM
tk_TM.utf8
tl_PH
tl_PH.iso88591
tl_PH.utf8
tn_ZA
tn_ZA.utf8
tr_CY
tr_CY.iso88599
tr_CY.utf8
tr_TR
tr_TR.iso88599
tr_TR.utf8
ts_ZA
ts_ZA.utf8
tt_RU
tt_RU.utf8
tt_RU.utf8@iqtelif
tt_RU@iqtelif
turkish
ug_CN
ug_CN.utf8
uk_UA
uk_UA.koi8u
uk_UA.utf8
unm_US
unm_US.utf8
ur_IN
ur_IN.utf8
ur_PK
ur_PK.utf8
uz_UZ
uz_UZ.iso88591
uz_UZ.utf8@cyrillic
uz_UZ@cyrillic
ve_ZA
ve_ZA.utf8
vi_VN
vi_VN.utf8
wa_BE
wa_BE.iso88591
wa_BE.iso885915@euro
wa_BE.utf8
wa_BE@euro
wae_CH
wae_CH.utf8
wal_ET
wal_ET.utf8
wo_SN
wo_SN.utf8
xh_ZA
xh_ZA.iso88591
xh_ZA.utf8
yi_US
yi_US.cp1255
yi_US.utf8
yo_NG
yo_NG.utf8
yue_HK
yue_HK.utf8
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
zh_HK
zh_HK.big5hkscs
zh_HK.utf8
zh_SG
zh_SG.gb2312
zh_SG.gbk
zh_SG.utf8
zh_TW
zh_TW.big5
zh_TW.euctw
zh_TW.utf8
zu_ZA
zu_ZA.iso88591
zu_ZA.utf8
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# localectl list-locales         #查看当前操作系统支持的语言
[root@node101.yinzhengjie.org.cn ~]# echo $LANG                  #很显然,我们安装操作系统时默认选的就是英文
en_US.UTF-8
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# localectl set-locale LANG=zh_CN.utf8    #我们将操作系统的语言换成中文的UTF-8,一般情况下不建议修改!修改后一些提示信息都会边长中文!包括提示信息以后都为中文啦,我们要习惯用英语,最好别改!
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo $LANG                  #修改后我们发现并没有立即生效
en_US.UTF-8
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# logout                    #推出当前的操作系统,推出当前终端方能生效

Connection closed by foreign host.

Disconnected from remote host(node101.yinzhengjie.org.cn) at 12:13:43.

Type `help' to learn how to use Xshell prompt.
[c:\~]$ 
Reconnecting in 1 seconds. Press any key to exit local shell.
.

Host 'node101.yinzhengjie.org.cn' resolved to 172.30.1.101.
Connecting to 172.30.1.101:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Sat Aug  3 20:13:25 2019 from 172.30.1.1
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo $LANG            #再次查看当前操作系统的界面支持的语言为发现生效啦~
zh_CN.utf8
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# localectl set-locale LANG=zh_CN.utf8    #我们将操作系统的语言换成中文的UTF-8,一般情况下不建议修改!修改后一些提示信息都会边长中文!包括提示信息以后都为中文啦,我们要习惯用英语,最好别改!

3>.外部命令查看帮助信息

内部命令:
  help COMMAND   
  man bash 

外部命令: 
  (1) COMMAND --help  或  COMMAND -h   
  (2) 使用手册(manual)        
    man COMMAND  
  (3) 信息页        
    info COMMAND   
  (4) 程序自身的帮助文档        
      README        
      INSTALL        
      ChangeLog   
  (5) 程序官方文档        
      官方站点:Documentation   
  (6) 发行版的官方文档   
  (7) Google 
[root@node101.yinzhengjie.org.cn ~]# date  --help              #查看外部命令date的帮助信息
Usage: date [OPTION]... [+FORMAT]
  or:  date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
Display the current time in the given FORMAT, or set the system date.

Mandatory arguments to long options are mandatory for short options too.
  -d, --date=STRING         display time described by STRING, not 'now'
  -f, --file=DATEFILE       like --date once for each line of DATEFILE
  -I[TIMESPEC], --iso-8601[=TIMESPEC]  output date/time in ISO 8601 format.
                            TIMESPEC='date' for date only (the default),
                            'hours', 'minutes', 'seconds', or 'ns' for date
                            and time to the indicated precision.
  -r, --reference=FILE      display the last modification time of FILE
  -R, --rfc-2822            output date and time in RFC 2822 format.
                            Example: Mon, 07 Aug 2006 12:34:56 -0600
      --rfc-3339=TIMESPEC   output date and time in RFC 3339 format.
                            TIMESPEC='date', 'seconds', or 'ns' for
                            date and time to the indicated precision.
                            Date and time components are separated by
                            a single space: 2006-08-07 12:34:56-06:00
  -s, --set=STRING          set time described by STRING
  -u, --utc, --universal    print or set Coordinated Universal Time (UTC)
      --help     display this help and exit
      --version  output version information and exit

FORMAT controls the output.  Interpreted sequences are:

  %%   a literal %
  %a   locale's abbreviated weekday name (e.g., Sun)
  %A   locale's full weekday name (e.g., Sunday)
  %b   locale's abbreviated month name (e.g., Jan)
  %B   locale's full month name (e.g., January)
  %c   locale's date and time (e.g., Thu Mar  3 23:05:25 2005)
  %C   century; like %Y, except omit last two digits (e.g., 20)
  %d   day of month (e.g., 01)
  %D   date; same as %m/%d/%y
  %e   day of month, space padded; same as %_d
  %F   full date; same as %Y-%m-%d
  %g   last two digits of year of ISO week number (see %G)
  %G   year of ISO week number (see %V); normally useful only with %V
  %h   same as %b
  %H   hour (00..23)
  %I   hour (01..12)
  %j   day of year (001..366)
  %k   hour, space padded ( 0..23); same as %_H
  %l   hour, space padded ( 1..12); same as %_I
  %m   month (01..12)
  %M   minute (00..59)
  %n   a newline
  %N   nanoseconds (000000000..999999999)
  %p   locale's equivalent of either AM or PM; blank if not known
  %P   like %p, but lower case
  %r   locale's 12-hour clock time (e.g., 11:11:04 PM)
  %R   24-hour hour and minute; same as %H:%M
  %s   seconds since 1970-01-01 00:00:00 UTC
  %S   second (00..60)
  %t   a tab
  %T   time; same as %H:%M:%S
  %u   day of week (1..7); 1 is Monday
  %U   week number of year, with Sunday as first day of week (00..53)
  %V   ISO week number, with Monday as first day of week (01..53)
  %w   day of week (0..6); 0 is Sunday
  %W   week number of year, with Monday as first day of week (00..53)
  %x   locale's date representation (e.g., 12/31/99)
  %X   locale's time representation (e.g., 23:13:48)
  %y   last two digits of year (00..99)
  %Y   year
  %z   +hhmm numeric time zone (e.g., -0400)
  %:z  +hh:mm numeric time zone (e.g., -04:00)
  %::z  +hh:mm:ss numeric time zone (e.g., -04:00:00)
  %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30)
  %Z   alphabetic time zone abbreviation (e.g., EDT)

By default, date pads numeric fields with zeroes.
The following optional flags may follow '%':

  -  (hyphen) do not pad the field
  _  (underscore) pad with spaces
  0  (zero) pad with zeros
  ^  use upper case if possible
  #  use opposite case if possible

After any flags comes an optional field width, as a decimal number;
then an optional modifier, which is either
E to use the locale's alternate representations if available, or
O to use the locale's alternate numeric symbols if available.

Examples:
Convert seconds since the epoch (1970-01-01 UTC) to a date
  $ date --date='@2147483647'

Show the time on the west coast of the US (use tzselect(1) to find TZ)
  $ TZ='America/Los_Angeles' date

Show the local time for 9AM next Friday on the west coast of the US
  $ date --date='TZ="America/Los_Angeles" 09:00 next Fri'

GNU coreutils online help: <http://www.gnu.org/software/coreutils/>
For complete documentation, run: info coreutils 'date invocation'
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date --help              #查看外部命令date的帮助信息
[root@node101.yinzhengjie.org.cn ~]# date                 #查看当前时间,现在为CST,即东八区
Sat Aug  3 19:53:22 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -u                #查看UTC时间,我们发现相差了8个小时呢~
Sat Aug  3 11:53:24 UTC 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -R               #如果如果时东八区,我们可以看到"-0800"的字样
Sat, 03 Aug 2019 19:57:47 +0800
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# date -R               #如果如果时东八区,我们可以看到"-0800"的字样
[root@node101.yinzhengjie.org.cn ~]# timedatectl list-timezones       #查看世界上所有的时区
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/Conakry
Africa/Dakar
Africa/Dar_es_Salaam
Africa/Djibouti
Africa/Douala
Africa/El_Aaiun
Africa/Freetown
Africa/Gaborone
Africa/Harare
Africa/Johannesburg
Africa/Juba
Africa/Kampala
Africa/Khartoum
Africa/Kigali
Africa/Kinshasa
Africa/Lagos
Africa/Libreville
Africa/Lome
Africa/Luanda
Africa/Lubumbashi
Africa/Lusaka
Africa/Malabo
Africa/Maputo
Africa/Maseru
Africa/Mbabane
Africa/Mogadishu
Africa/Monrovia
Africa/Nairobi
Africa/Ndjamena
Africa/Niamey
Africa/Nouakchott
Africa/Ouagadougou
Africa/Porto-Novo
Africa/Sao_Tome
Africa/Tripoli
Africa/Tunis
Africa/Windhoek
America/Adak
America/Anchorage
America/Anguilla
America/Antigua
America/Araguaina
America/Argentina/Buenos_Aires
America/Argentina/Catamarca
America/Argentina/Cordoba
America/Argentina/Jujuy
America/Argentina/La_Rioja
America/Argentina/Mendoza
America/Argentina/Rio_Gallegos
America/Argentina/Salta
America/Argentina/San_Juan
America/Argentina/San_Luis
America/Argentina/Tucuman
America/Argentina/Ushuaia
America/Aruba
America/Asuncion
America/Atikokan
America/Bahia
America/Bahia_Banderas
America/Barbados
America/Belem
America/Belize
America/Blanc-Sablon
America/Boa_Vista
America/Bogota
America/Boise
America/Cambridge_Bay
America/Campo_Grande
America/Cancun
America/Caracas
America/Cayenne
America/Cayman
America/Chicago
America/Chihuahua
America/Costa_Rica
America/Creston
America/Cuiaba
America/Curacao
America/Danmarkshavn
America/Dawson
America/Dawson_Creek
America/Denver
America/Detroit
America/Dominica
America/Edmonton
America/Eirunepe
America/El_Salvador
America/Fort_Nelson
America/Fortaleza
America/Glace_Bay
America/Godthab
America/Goose_Bay
America/Grand_Turk
America/Grenada
America/Guadeloupe
America/Guatemala
America/Guayaquil
America/Guyana
America/Halifax
America/Havana
America/Hermosillo
America/Indiana/Indianapolis
America/Indiana/Knox
America/Indiana/Marengo
America/Indiana/Petersburg
America/Indiana/Tell_City
America/Indiana/Vevay
America/Indiana/Vincennes
America/Indiana/Winamac
America/Inuvik
America/Iqaluit
America/Jamaica
America/Juneau
America/Kentucky/Louisville
America/Kentucky/Monticello
America/Kralendijk
America/La_Paz
America/Lima
America/Los_Angeles
America/Lower_Princes
America/Maceio
America/Managua
America/Manaus
America/Marigot
America/Martinique
America/Matamoros
America/Mazatlan
America/Menominee
America/Merida
America/Metlakatla
America/Mexico_City
America/Miquelon
America/Moncton
America/Monterrey
America/Montevideo
America/Montserrat
America/Nassau
America/New_York
America/Nipigon
America/Nome
America/Noronha
America/North_Dakota/Beulah
America/North_Dakota/Center
America/North_Dakota/New_Salem
America/Ojinaga
America/Panama
America/Pangnirtung
America/Paramaribo
America/Phoenix
America/Port-au-Prince
America/Port_of_Spain
America/Porto_Velho
America/Puerto_Rico
America/Punta_Arenas
America/Rainy_River
America/Rankin_Inlet
America/Recife
America/Regina
America/Resolute
America/Rio_Branco
America/Santarem
America/Santiago
America/Santo_Domingo
America/Sao_Paulo
America/Scoresbysund
America/Sitka
America/St_Barthelemy
America/St_Johns
America/St_Kitts
America/St_Lucia
America/St_Thomas
America/St_Vincent
America/Swift_Current
America/Tegucigalpa
America/Thule
America/Thunder_Bay
America/Tijuana
America/Toronto
America/Tortola
America/Vancouver
America/Whitehorse
America/Winnipeg
America/Yakutat
America/Yellowknife
Antarctica/Casey
Antarctica/Davis
Antarctica/DumontDUrville
Antarctica/Macquarie
Antarctica/Mawson
Antarctica/McMurdo
Antarctica/Palmer
Antarctica/Rothera
Antarctica/Syowa
Antarctica/Troll
Antarctica/Vostok
Arctic/Longyearbyen
Asia/Aden
Asia/Almaty
Asia/Amman
Asia/Anadyr
Asia/Aqtau
Asia/Aqtobe
Asia/Ashgabat
Asia/Atyrau
Asia/Baghdad
Asia/Bahrain
Asia/Baku
Asia/Bangkok
Asia/Barnaul
Asia/Beirut
Asia/Bishkek
Asia/Brunei
Asia/Chita
Asia/Choibalsan
Asia/Colombo
Asia/Damascus
Asia/Dhaka
Asia/Dili
Asia/Dubai
Asia/Dushanbe
Asia/Famagusta
Asia/Gaza
Asia/Hebron
Asia/Ho_Chi_Minh
Asia/Hong_Kong
Asia/Hovd
Asia/Irkutsk
Asia/Jakarta
Asia/Jayapura
Asia/Jerusalem
Asia/Kabul
Asia/Kamchatka
Asia/Karachi
Asia/Kathmandu
Asia/Khandyga
Asia/Kolkata
Asia/Krasnoyarsk
Asia/Kuala_Lumpur
Asia/Kuching
Asia/Kuwait
Asia/Macau
Asia/Magadan
Asia/Makassar
Asia/Manila
Asia/Muscat
Asia/Nicosia
Asia/Novokuznetsk
Asia/Novosibirsk
Asia/Omsk
Asia/Oral
Asia/Phnom_Penh
Asia/Pontianak
Asia/Pyongyang
Asia/Qatar
Asia/Qyzylorda
Asia/Riyadh
Asia/Sakhalin
Asia/Samarkand
Asia/Seoul
Asia/Shanghai
Asia/Singapore
Asia/Srednekolymsk
Asia/Taipei
Asia/Tashkent
Asia/Tbilisi
Asia/Tehran
Asia/Thimphu
Asia/Tokyo
Asia/Tomsk
Asia/Ulaanbaatar
Asia/Urumqi
Asia/Ust-Nera
Asia/Vientiane
Asia/Vladivostok
Asia/Yakutsk
Asia/Yangon
Asia/Yekaterinburg
Asia/Yerevan
Atlantic/Azores
Atlantic/Bermuda
Atlantic/Canary
Atlantic/Cape_Verde
Atlantic/Faroe
Atlantic/Madeira
Atlantic/Reykjavik
Atlantic/South_Georgia
Atlantic/St_Helena
Atlantic/Stanley
Australia/Adelaide
Australia/Brisbane
Australia/Broken_Hill
Australia/Currie
Australia/Darwin
Australia/Eucla
Australia/Hobart
Australia/Lindeman
Australia/Lord_Howe
Australia/Melbourne
Australia/Perth
Australia/Sydney
Europe/Amsterdam
Europe/Andorra
Europe/Astrakhan
Europe/Athens
Europe/Belgrade
Europe/Berlin
Europe/Bratislava
Europe/Brussels
Europe/Bucharest
Europe/Budapest
Europe/Busingen
Europe/Chisinau
Europe/Copenhagen
Europe/Dublin
Europe/Gibraltar
Europe/Guernsey
Europe/Helsinki
Europe/Isle_of_Man
Europe/Istanbul
Europe/Jersey
Europe/Kaliningrad
Europe/Kiev
Europe/Kirov
Europe/Lisbon
Europe/Ljubljana
Europe/London
Europe/Luxembourg
Europe/Madrid
Europe/Malta
Europe/Mariehamn
Europe/Minsk
Europe/Monaco
Europe/Moscow
Europe/Oslo
Europe/Paris
Europe/Podgorica
Europe/Prague
Europe/Riga
Europe/Rome
Europe/Samara
Europe/San_Marino
Europe/Sarajevo
Europe/Saratov
Europe/Simferopol
Europe/Skopje
Europe/Sofia
Europe/Stockholm
Europe/Tallinn
Europe/Tirane
Europe/Ulyanovsk
Europe/Uzhgorod
Europe/Vaduz
Europe/Vatican
Europe/Vienna
Europe/Vilnius
Europe/Volgograd
Europe/Warsaw
Europe/Zagreb
Europe/Zaporozhye
Europe/Zurich
Indian/Antananarivo
Indian/Chagos
Indian/Christmas
Indian/Cocos
Indian/Comoro
Indian/Kerguelen
Indian/Mahe
Indian/Maldives
Indian/Mauritius
Indian/Mayotte
Indian/Reunion
Pacific/Apia
Pacific/Auckland
Pacific/Bougainville
Pacific/Chatham
Pacific/Chuuk
Pacific/Easter
Pacific/Efate
Pacific/Enderbury
Pacific/Fakaofo
Pacific/Fiji
Pacific/Funafuti
Pacific/Galapagos
Pacific/Gambier
Pacific/Guadalcanal
Pacific/Guam
Pacific/Honolulu
Pacific/Kiritimati
Pacific/Kosrae
Pacific/Kwajalein
Pacific/Majuro
Pacific/Marquesas
Pacific/Midway
Pacific/Nauru
Pacific/Niue
Pacific/Norfolk
Pacific/Noumea
Pacific/Pago_Pago
Pacific/Palau
Pacific/Pitcairn
Pacific/Pohnpei
Pacific/Port_Moresby
Pacific/Rarotonga
Pacific/Saipan
Pacific/Tahiti
Pacific/Tarawa
Pacific/Tongatapu
Pacific/Wake
Pacific/Wallis
UTC
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# timedatectl list-timezones       #查看世界上所有的时区,该命令只有在CentOS7才会安装,在CentOS6默认时没有安装的
[root@node101.yinzhengjie.org.cn ~]# date 
Sat Aug  3 19:59:31 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -R
Sat, 03 Aug 2019 19:59:33 +0800
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# timedatectl set-timezone America/New_York        #修改时区为美国的纽约
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -R
Sat, 03 Aug 2019 07:59:44 -0400
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date 
Sat Aug  3 07:59:47 EDT 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -u                            #查看UTC时间
Sat Aug 3 12:00:21 UTC 2019
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# timedatectl set-timezone America/New_York        #修改时区为美国的纽约
[root@node101.yinzhengjie.org.cn ~]# ll /etc/localtime                     #我们可以查看当前时间指定的时区文件为美国纽约时间文件
lrwxrwxrwx. 1 root root 38 Aug  3 07:59 /etc/localtime -> ../usr/share/zoneinfo/America/New_York
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -R
Sat, 03 Aug 2019 08:02:19 -0400
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date 
Sat Aug  3 08:02:23 EDT 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# timedatectl set-timezone Asia/Shanghai        #我们把时区修改为亚洲的上海
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date 
Sat Aug  3 20:02:32 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -R        
Sat, 03 Aug 2019 20:02:36 +0800
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ll /etc/localtime                       #修改时区成功后,我们发现该文件指定的时区文件也发生了变化哟~
lrwxrwxrwx. 1 root root 35 Aug  3 20:02 /etc/localtime -> ../usr/share/zoneinfo/Asia/Shanghai
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ll /etc/localtime                       #修改时区成功后,我们发现该文件指定的时区文件也发生了变化哟~
[root@node101.yinzhengjie.org.cn ~]# date                      #查看操作系统当前时间
Sat Aug  3 20:18:28 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date +%Y-%m-%d                #自定义时间的打印格式
2019-08-03
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date +%F                    #打印年月日,其实我们上面自定义的打印格式,我们直接输入默认就已经定义了这种格式
2019-08-03
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date +%T                    #打印时分秒,
20:19:23
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date "+%F %T"                 #如果使用多个参数的话,需要使用双引号将其括起来。
2019-08-03 20:19:42
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date +%F_%T                  #当然,除了上面使用双引号将其括起来,还可以使用下划线来连接两个参数,达到了自定义时间的输出格式的目的
2019-08-03_20:20:02
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date 080312242019.30             #修改操作系统的时间
Sat Aug 3 12:24:30 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date                      #不难发现时间被修改啦~
Sat Aug 3 12:24:32 CST 2019
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# date +%s                    #查看是时间戳,从1970-1-1 00:00:00到目前位置经过的秒数。
1567485345
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# date                       #查当前时间
Sun Aug  4 12:28:04 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -d "yesterday"              #查看昨天的时间
Sat Aug  3 12:28:16 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -d "yesterday" +%F            #查看昨天的时间并按照格式化输出
2019-08-03
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -d "tomorrow" +%F            #查看明天的时间
2019-08-05
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -d "-20 days" +%F            #查看20天前的时间
2019-07-15
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -d "30 days" +%F            #查看30天后的时间,这个只是查看时间而已,并没有修改哟~
2019-09-03
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date                       #查看当前时间,很显然时间并没有发生变化
Sun Aug 4 12:31:09 CST 2019
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# date -d "30 days" +%F            #查看30天后的时间,这个只是查看时间而已,并没有修改哟~
[root@node101.yinzhengjie.org.cn ~]# date 
Sun Aug  4 12:32:25 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -s "30 days" +%F          #我们发现它不仅仅能查看时间,而且还把时间给改啦!
2019-09-03
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date                     #很显然,时间被该了一个月(30天)啦!
Tue Sep  3 12:32:32 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date -s "30 days" +%F          #我们发现它不仅仅能查看时间,而且还把时间给改啦!
[root@node101.yinzhengjie.org.cn ~]# clock                    #主板时间,我们也可以称之为硬件时间,这个时间一般和操作系统时间相同,但是当主板的电池被扣了或者没电的话,可能每次开机时间都不会准确啦!
Sat 03 Aug 2019 08:29:43 PM CST  -0.131667 seconds
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date                     #查看操作系统的时间,发现主板上的时间和操作系统的时间不一致!
Sat Aug 3 12:30:44 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# clock -s                  #将硬件时间同步到操作系统时间,这样就保证了操作系统的时间与硬件时间一致!
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date                     #很显然,操作系统时间和主板时间相同啦!
Sat Aug 3 20:33:38 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# clock                      #2个时间时时一致性的,只不过操作系统用的是24小时计时法,而硬件使用的是12小时计时法
Sat 03 Aug 2019 08:33:55 PM CST -0.942629 seconds
[root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# clock -s                  #将硬件时间同步到操作系统时间,这样就保证了操作系统的时间与硬件时间一致!
[root@node101.yinzhengjie.org.cn ~]# date                     #查看系统的时间
Sun Aug  4 12:25:07 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# clock                    #查看主板的时间
Sat 03 Aug 2019 08:38:39 PM CST  -0.708404 seconds
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# clock -w                  #我们将操作系统的时间同步到主板上来,这样就保证了硬件的时间和操作系统时间一致!
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# clock                    #再次查看硬件时间,发现硬件时间被修改啦,和操作系统时间一致啦~
Sun 04 Aug 2019 12:25:28 PM CST  -0.958213 seconds
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# clock -w                  #我们将操作系统的时间同步到主板上来,这样就保证了硬件的时间和操作系统时间一致!
[root@node101.yinzhengjie.org.cn ~]# cal --help

Usage:
 cal [options] [[[day] month] year]

Options:
 -1, --one        show only current month (default)
 -3, --three      show previous, current and next month
 -s, --sunday     Sunday as first day of week
 -m, --monday     Monday as first day of week
 -j, --julian     output Julian dates
 -y, --year       show whole current year
 -V, --version    display version information and exit
 -h, --help       display this help text and exit

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cal --help
[root@node101.yinzhengjie.org.cn ~]# cal 2020                  #查看某一年的帮助信息
                               2020                               

       January               February                 March       
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
          1  2  3  4                      1    1  2  3  4  5  6  7
 5  6  7  8  9 10 11    2  3  4  5  6  7  8    8  9 10 11 12 13 14
12 13 14 15 16 17 18    9 10 11 12 13 14 15   15 16 17 18 19 20 21
19 20 21 22 23 24 25   16 17 18 19 20 21 22   22 23 24 25 26 27 28
26 27 28 29 30 31      23 24 25 26 27 28 29   29 30 31

        April                   May                   June        
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
          1  2  3  4                   1  2       1  2  3  4  5  6
 5  6  7  8  9 10 11    3  4  5  6  7  8  9    7  8  9 10 11 12 13
12 13 14 15 16 17 18   10 11 12 13 14 15 16   14 15 16 17 18 19 20
19 20 21 22 23 24 25   17 18 19 20 21 22 23   21 22 23 24 25 26 27
26 27 28 29 30         24 25 26 27 28 29 30   28 29 30
                       31
        July                  August                September     
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
          1  2  3  4                      1          1  2  3  4  5
 5  6  7  8  9 10 11    2  3  4  5  6  7  8    6  7  8  9 10 11 12
12 13 14 15 16 17 18    9 10 11 12 13 14 15   13 14 15 16 17 18 19
19 20 21 22 23 24 25   16 17 18 19 20 21 22   20 21 22 23 24 25 26
26 27 28 29 30 31      23 24 25 26 27 28 29   27 28 29 30
                       30 31
       October               November               December      
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
             1  2  3    1  2  3  4  5  6  7          1  2  3  4  5
 4  5  6  7  8  9 10    8  9 10 11 12 13 14    6  7  8  9 10 11 12
11 12 13 14 15 16 17   15 16 17 18 19 20 21   13 14 15 16 17 18 19
18 19 20 21 22 23 24   22 23 24 25 26 27 28   20 21 22 23 24 25 26
25 26 27 28 29 30 31   29 30                  27 28 29 30 31


[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cal 2020                  #查看某一年的帮助信息
[root@node101.yinzhengjie.org.cn ~]# cal 8  2020                 #查看某年某月的日历
     August 2020    
Su Mo Tu We Th Fr Sa
                   1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cal 8 2020                 #查看某年某月的日历
[root@node101.yinzhengjie.org.cn ~]# cal -y                   #显示日历
                               2019                               

       January               February                 March       
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
       1  2  3  4  5                   1  2                   1  2
 6  7  8  9 10 11 12    3  4  5  6  7  8  9    3  4  5  6  7  8  9
13 14 15 16 17 18 19   10 11 12 13 14 15 16   10 11 12 13 14 15 16
20 21 22 23 24 25 26   17 18 19 20 21 22 23   17 18 19 20 21 22 23
27 28 29 30 31         24 25 26 27 28         24 25 26 27 28 29 30
                                              31
        April                   May                   June        
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
    1  2  3  4  5  6             1  2  3  4                      1
 7  8  9 10 11 12 13    5  6  7  8  9 10 11    2  3  4  5  6  7  8
14 15 16 17 18 19 20   12 13 14 15 16 17 18    9 10 11 12 13 14 15
21 22 23 24 25 26 27   19 20 21 22 23 24 25   16 17 18 19 20 21 22
28 29 30               26 27 28 29 30 31      23 24 25 26 27 28 29
                                              30
        July                  August                September     
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
    1  2  3  4  5  6                1  2  3    1  2  3  4  5  6  7
 7  8  9 10 11 12 13    4  5  6  7  8  9 10    8  9 10 11 12 13 14
14 15 16 17 18 19 20   11 12 13 14 15 16 17   15 16 17 18 19 20 21
21 22 23 24 25 26 27   18 19 20 21 22 23 24   22 23 24 25 26 27 28
28 29 30 31            25 26 27 28 29 30 31   29 30

       October               November               December      
Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa   Su Mo Tu We Th Fr Sa
       1  2  3  4  5                   1  2    1  2  3  4  5  6  7
 6  7  8  9 10 11 12    3  4  5  6  7  8  9    8  9 10 11 12 13 14
13 14 15 16 17 18 19   10 11 12 13 14 15 16   15 16 17 18 19 20 21
20 21 22 23 24 25 26   17 18 19 20 21 22 23   22 23 24 25 26 27 28
27 28 29 30 31         24 25 26 27 28 29 30   29 30 31


[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cal -y                   #显示日历

4>.man帮助信息

一.man命令概述
  (1)提供命令帮助的文件 
  (2)手册页存放在/usr/share/man 
  (3)几乎每个命令都有man的“页面” 
  (4)man页面分组为不同的“章节” 
  (5)统称为Linux手册 
  (6)man命令的配置文件:
    /etc/man.config | man_db.conf  
    MANPATH /PATH/TO/SOMEWHERE: 指明man文件搜索位置 
  (7)man -M /PATH/TO/SOMEWHERE COMMAND: 
    到指定位置下搜索 COMMAND命令的手册页并显示 
  (8)中文man需安装包man-pages-zh-CN 


二.man 章节(对于用户来讲,我们只需要关系1-9这几个章节即可,其他章节可忽略,基本上咱们运维也用不上呀~) 
  (1)用户命令 
  (2)系统调用 
  (3)C库调用 
  (4)设备文件及特殊文件 
  (5)配置文件格式 
  (6)游戏 
  (7)杂项 
  (8)管理类的命令 
  (9)Linux 内核API  

三.man 帮助段落说明 
  (1)NAME 名称及简要说明
  (2)SYNOPSIS 用法格式说明
    []   :  可选内容
    <>   :  必选内容 
     a|b  :  二选一
    { }  :  分组 
     ...: :  同一内容可出现多次
  (3)DESCRIPTION 详细说明 
  (4)OPTIONS 选项说明
  (5)EXAMPLES 示例
  (6)FILES 相关文件
  (7)AUTHOR 作者 
  (8)COPYRIGHT 版本信息
  (9)REPORTING BUGS bug信息
  (10)SEE ALSO 其它帮助参考

四.man 帮助 
  (1)查看man手册页
     man [章节] keyword
  (2)列出所有帮助
     man –a keyword
  (3)搜索man手册
     man -k keyword 列出所有匹配的页面
     使用 whatis 数据库
  (4)相当于whatis
     man –f keyword
  (5)打印man帮助文件的路径
     manw [章节] keyword 


五.man命令的操作方法:使用less命令实现  
  space, ^v, ^f, ^F: 向文件尾翻屏  
  b, ^b: 向文件首部翻屏  
  d, ^d: 向文件尾部翻半屏  
  u, ^u: 向文件首部翻半屏  
  RETURN, ^N, e, ^E or j or ^J: 向文件尾部翻一行   
  y or ^Y or ^P or k or ^K:向文件首部翻一行  
  q: 退出  
  #:跳转至第#行  
  1G: 回到文件首部  
  G:翻至文件尾部 


六.man搜索 
  /KEYWORD:
     以KEYWORD指定的字符串为关键字,从当前位置向文件尾部搜索;不区分字符大小写;
       n: 下一个
       N:上一个
  ?KEYWORD:
     以KEYWORD指定的字符串为关键字,从当前位置向文件首部搜索;不区 分字符大小写;
       n: 跟搜索命令同方向,下一个
       N:跟搜索命令反方向,上一个
[root@node101.yinzhengjie.org.cn ~]# man date                                    #查看date命令的man帮助信息
DATE(1)                                                    User Commands                                                    DATE(1)

NAME
       date - print or set the system date and time

SYNOPSIS
       date [OPTION]... [+FORMAT]
       date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]

DESCRIPTION
       Display the current time in the given FORMAT, or set the system date.

       Mandatory arguments to long options are mandatory for short options too.

       -d, --date=STRING
              display time described by STRING, not 'now'

       -f, --file=DATEFILE
              like --date once for each line of DATEFILE

       -I[TIMESPEC], --iso-8601[=TIMESPEC]
              output  date/time in ISO 8601 format.  TIMESPEC='date' for date only (the default), 'hours', 'minutes', 'seconds', or
              'ns' for date and time to the indicated precision.

       -r, --reference=FILE
              display the last modification time of FILE

       -R, --rfc-2822
              output date and time in RFC 2822 format.  Example: Mon, 07 Aug 2006 12:34:56 -0600

       --rfc-3339=TIMESPEC
              output date and time in RFC 3339 format.  TIMESPEC='date', 'seconds', or 'ns' for date and time to the indicated pre‐
              cision.  Date and time components are separated by a single space: 2006-08-07 12:34:56-06:00

       -s, --set=STRING
              set time described by STRING

       -u, --utc, --universal
              print or set Coordinated Universal Time (UTC)

       --help display this help and exit

       --version
              output version information and exit

       FORMAT controls the output.  Interpreted sequences are:

       %%     a literal %

       %a     locale's abbreviated weekday name (e.g., Sun)

       %A     locale's full weekday name (e.g., Sunday)

       %b     locale's abbreviated month name (e.g., Jan)

       %B     locale's full month name (e.g., January)

       %c     locale's date and time (e.g., Thu Mar  3 23:05:25 2005)

       %C     century; like %Y, except omit last two digits (e.g., 20)

       %d     day of month (e.g., 01)

       %D     date; same as %m/%d/%y

       %e     day of month, space padded; same as %_d

       %F     full date; same as %Y-%m-%d

       %g     last two digits of year of ISO week number (see %G)

       %G     year of ISO week number (see %V); normally useful only with %V

       %h     same as %b

       %H     hour (00..23)

       %I     hour (01..12)

       %j     day of year (001..366)

       %k     hour, space padded ( 0..23); same as %_H

       %l     hour, space padded ( 1..12); same as %_I

       %m     month (01..12)

       %M     minute (00..59)

       %n     a newline

       %N     nanoseconds (000000000..999999999)

       %p     locale's equivalent of either AM or PM; blank if not known

       %P     like %p, but lower case

       %r     locale's 12-hour clock time (e.g., 11:11:04 PM)

       %R     24-hour hour and minute; same as %H:%M

       %s     seconds since 1970-01-01 00:00:00 UTC

       %S     second (00..60)

       %t     a tab

       %T     time; same as %H:%M:%S

       %u     day of week (1..7); 1 is Monday

       %U     week number of year, with Sunday as first day of week (00..53)

       %V     ISO week number, with Monday as first day of week (01..53)

       %w     day of week (0..6); 0 is Sunday

       %W     week number of year, with Monday as first day of week (00..53)

       %x     locale's date representation (e.g., 12/31/99)

       %X     locale's time representation (e.g., 23:13:48)

       %y     last two digits of year (00..99)

       %Y     year

       %z     +hhmm numeric time zone (e.g., -0400)

       %:z    +hh:mm numeric time zone (e.g., -04:00)

       %::z   +hh:mm:ss numeric time zone (e.g., -04:00:00)

       %:::z  numeric time zone with : to necessary precision (e.g., -04, +05:30)

       %Z     alphabetic time zone abbreviation (e.g., EDT)

       By default, date pads numeric fields with zeroes.  The following optional flags may follow '%':

       -      (hyphen) do not pad the field

       _      (underscore) pad with spaces

       0      (zero) pad with zeros

       ^      use upper case if possible

       #      use opposite case if possible

       After  any flags comes an optional field width, as a decimal number; then an optional modifier, which is either E to use the
       locale's alternate representations if available, or O to use the locale's alternate numeric symbols if available.

ENVIRONMENT
       TZ     Specifies the timezone, unless overridden by command line parameters.  If neither  is  specified,  the  setting  from
              /etc/localtime is used.
EXAMPLES
       Convert seconds since the epoch (1970-01-01 UTC) to a date

              $ date --date='@2147483647'

       Show the time on the west coast of the US (use tzselect(1) to find TZ)

              $ TZ='America/Los_Angeles' date

       Show the local time for 9AM next Friday on the west coast of the US

              $ date --date='TZ="America/Los_Angeles" 09:00 next Fri'

       GNU  coreutils online help: <http://www.gnu.org/software/coreutils/> Report date translation bugs to <http://translationpro
       ject.org/team/>

DATE STRING
       The --date=STRING is a mostly free format human readable  date  string  such  as  "Sun,  29  Feb  2004  16:21:42  -0800"  or
       "2004-02-29  16:21:42" or even "next Thursday".  A date string may contain items indicating calendar date, time of day, time
       zone, day of week, relative time, relative date, and numbers.  An empty string indicates the beginning of the day.  The date
       string format is more complex than is easily documented here but is fully described in the info documentation.

AUTHOR
       Written by David MacKenzie.

COPYRIGHT
       GNU  coreutils online help: <http://www.gnu.org/software/coreutils/> Report date translation bugs to <http://translationpro
       ject.org/team/>

DATE STRING
       The --date=STRING is a mostly free format human readable  date  string  such  as  "Sun,  29  Feb  2004  16:21:42  -0800"  or
       "2004-02-29  16:21:42" or even "next Thursday".  A date string may contain items indicating calendar date, time of day, time
       zone, day of week, relative time, relative date, and numbers.  An empty string indicates the beginning of the day.  The date
       string format is more complex than is easily documented here but is fully described in the info documentation.

AUTHOR
       Written by David MacKenzie.

COPYRIGHT
       Copyright    ©    2013    Free    Software    Foundation,   Inc.    License   GPLv3+:   GNU   GPL   version   3   or   later
       <http://gnu.org/licenses/gpl.html>.
       This is free software: you are free to change and redistribute it.  There is NO WARRANTY, to the extent permitted by law.

SEE ALSO
       The full documentation for date is maintained as a Texinfo manual.  If the info and date programs are properly installed  at
       your site, the command

              info coreutils 'date invocation'

       should give you access to the complete manual.

GNU coreutils 8.22                                          October 2018                                                    DATE(1)
[root@node101.yinzhengjie.org.cn ~]# man date #查看date命令的man帮助信息
[root@node101.yinzhengjie.org.cn ~]# whatis passwd            #查询passwd相关的帮助信息
passwd (5)           - password file                    #我们看到了括号里面有一个数字5,说明要查看它的man帮助章节信息应该为配置文件格式的,而whatis也说他是一个密码文件。
passwd (1)           - update user's authentication tokens       #我们可以看到括号里面有一个数字1,说明查看它的man帮助章节信息应该为用户命令,而whatis也说他是用来更新用户认证的令牌的。
sslpasswd (1ssl)     - compute password hashes              #这个1ssl适合加密相关的章节,这里的帮助信息基本上是和开发相关的,咱们运维一般不用关心它。
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# man 5 passwd            #我们查看配置文件
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# man 1 passwd
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# whereis passwd
passwd: /usr/bin/passwd /etc/passwd /usr/share/man/man5/passwd.5.gz /usr/share/man/man1/passwd.1.gz
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# man -w passwd
/usr/share/man/man1/passwd.1.gz
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# man -w 5 passwd        #查看命令的帮助文件所作路径
/usr/share/man/man5/passwd.5.gz
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# man -w 5 passwd        #查看命令的帮助文件所作路径

5>.info(不常用)

一.info概述
    (1)man常用于命令参考 ,GNU工具info适合通用文档参考 
    (2)没有参数,列出所有的页面 
    (3info 页面的结构就像一个网站 
    (4)每一页分为“节点” 
    (5)链接节点之前 *
    (6info [ 命令 ] 
 
二.导航info页 
    (1)方向键,PgUp,PgDn 导航
    (2)Tab键 移动到下一个链接
    (3)d 显示主题目录
    (4)Home 显示主题首部
    (5)Enter进入 选定链接
    (6)n/p/u/l 进入下/前/上一层/最后一个链接
    (7)s 文字 文本搜索
    (8)q 退出 info 
[root@node101.yinzhengjie.org.cn ~]# info 
File: dir       Node: Top       This is the top of the INFO tree

  This (the Directory node) gives a menu of major topics. 
  Typing "q" exits, "?" lists all Info commands, "d" returns here,
  "h" gives a primer for first-timers,
  "mEmacs<Return>" visits the Emacs topic, etc.

  In Emacs, you can click mouse button 2 on a menu item or cross reference
  to select it.

* Menu: 

Archiving
* Cpio: (cpio).                 Copy-in-copy-out archiver to tape or disk.
* Tar: (tar).                   Making tape (or disk) archives.

Basics
* Common options: (coreutils)Common options.
* Coreutils: (coreutils).       Core GNU (file, text, shell) utilities.
* Date input formats: (coreutils)Date input formats.
* File permissions: (coreutils)File permissions.
                                Access modes.
* File permissions: (coreutils)File permissions.
                                Access modes.
* Finding files: (find).        Operating on files matching certain criteria.
* ed: (ed).                     The GNU Line Editor.

Compression
* Gzip: (gzip).                 General (de)compression of files (lzw).

Editors
* nano: (nano).                 Small and friendly text editor.

Emacs
* IDN Library: (libidn)Emacs API.
                                Emacs API for IDN functions.

Encryption
* Nettle: (nettle).             A low-level cryptographic library.

GNU C library functions and macros
* __fbufsize: (libc)Controlling Buffering.
* __flbf: (libc)Controlling Buffering.
* __fpending: (libc)Controlling Buffering.
.......
[root@node101.yinzhengjie.org.cn ~]# info

6>.通过本地文档获取帮助 

System->help(centos6 图像界面) 

Applications -> documentation->help(centos7 图像界面) 提供的官方使用指南和发行注记

/usr/share/doc目录
  多数安装了的软件包的子目录,包括了这些软件的相关原理说明
  常见文档:README INSTALL CHANGES
  不适合其它地方的文档的位置
    配置文件范例
    HTML/PDF/PS 格式的文档
    授权书详情
[root@node101.yinzhengjie.org.cn ~]# ll /usr/share/doc/ |wc -l                #安装软件成功后,在这个目录下有对应的文档
1023
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ll /usr/share/doc/ | grep bc-1.06.95         #举个栗子,我们在操作系统默认安装了bc工具,因此我们可以进入bc的帮助文档目录
drwxr-xr-x.  3 root root  108 Aug  1 21:59 bc-1.06.95
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ll /usr/share/doc/bc-1.06.95/              #这里就是bc文档的相关信息
total 64
-rw-r--r--. 1 root root   241 Jun 15  2006 AUTHORS
-rw-r--r--. 1 root root 17997 May 27  2005 COPYING
-rw-r--r--. 1 root root 26545 May 27  2005 COPYING.LIB
drwxr-xr-x. 2 root root    65 Aug  1 21:59 Examples
-rw-r--r--. 1 root root  1335 Apr 21  2006 FAQ
-rw-r--r--. 1 root root  2627 Apr 21  2006 NEWS
-rw-r--r--. 1 root root  3522 Jul 14  2000 README
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# ll /usr/share/doc/ |wc -l                #安装软件成功后,在这个目录下有对应的文档

7>.通过在线文档获取帮助 

第三方应用官方文档 
  http://httpd.apache.org 
  http://www.nginx.org 
  https://mariadb.com/kb/en 
  https://dev.mysql.com/doc/ 
  http://tomcat.apache.org 
  http://www.python.org 

通过发行版官方的文档光盘或网站可以获得 
  安装指南、部署指南、虚拟化指南等 
  红帽知识库和官方在线文档    
    http://kbase.redhat.com     
    http://www.redhat.com/docs     
    http://access.redhat.com     
    https://help.ubuntu.com/lts/serverguide/index.html 

网站和搜索 
  http://tldp.org             #Linux的学习网站
  http://www.slideshare.net       #存放各种幻灯片的网站,可以直接把别人写好的文档下载下来来然后自己用
  http://www.google.com     
  搜索技巧:
    Openstack filetype:pdf       #只搜索PDF文件且包含openstack字样的链接
    rhca site:redhat.com/docs    #只在红帽官方网站的docs目录下搜索rhca字样的链接

8>.小试牛刀

通过帮助信息,在本机字符终端登录时,除显示原有信息外,再显示当前登录终端号,主机名和当前时间

1>.第一步查看"issue"的用法
  whatis issue
  man issue

2>.找到符合题意的变量并写入到issue的配置文件中即可
    [root@node101.yinzhengjie.org.cn ~]# cat /etc/issue
    terminal is \l

    hostname is \n

    time is \t


    welcome to https://www.cnblogs.com/yinzhengjie/    !!!

    \S
    Kernel \r on an \m

    [root@node101.yinzhengjie.org.cn ~]#
[root@node101.yinzhengjie.org.cn ~]# whatis issue
issue (5)            - prelogin message and identification file
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# man issue                               #查看issue的相关帮助信息


ISSUE(5)                                             Linux Programmer's Manual                                             ISSUE(5)

NAME
       issue - prelogin message and identification file

DESCRIPTION
       The  file /etc/issue is a text file which contains a message or system identification to be printed before the login prompt.
       It may contain various @char and \char sequences, if supported by the getty-type program employed on the system.

FILES
       /etc/issue

SEE ALSO
       motd(5), agetty(8), mingetty(8)        #这里让我们参考这3个文件,我们可以参考一下agetty命令的帮助信息

COLOPHON
       This page is part of release 3.53 of the Linux man-pages project.  A description  of  the  project,  and  information  about
       reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.

Linux                                                        1993-07-24                                                    ISSUE(5)
[root@node101.yinzhengjie.org.cn ~]# man issue       #查看issue的相关帮助信息
[root@node101.yinzhengjie.org.cn ~]# whatis agetty
agetty (8)           - alternative Linux getty
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# man 8 agetty
AGETTY(8)                                              System Administration                                              AGETTY(8)

NAME
       agetty - alternative Linux getty

SYNOPSIS
       agetty [options] port [baud_rate...]  [term]

DESCRIPTION
       agetty opens a tty port, prompts for a login name and invokes the /bin/login command. It is normally invoked by init(8).

       agetty has several non-standard features that are useful for hard-wired and for dial-in lines:

       ·      Adapts the tty settings to parity bits and to erase, kill, end-of-line and uppercase characters when it reads a login
              name.  The program can handle 7-bit characters with even, odd, none or space parity, and  8-bit  characters  with  no
              parity.  The  following  special  characters  are  recognized: Control-U (kill); DEL and back space (erase); carriage
              return and line feed (end of line).  See also --erase-chars and --kill-chars options.

       ·      Optionally deduces the baud rate from the CONNECT messages produced by Hayes(tm)-compatible modems.

       ·      Optionally does not hang up when it is given an already opened line (useful for call-back applications).

       ·      Optionally does not display the contents of the /etc/issue file.

       ·      Optionally displays an alternative issue file instead of /etc/issue.
       ·      Optionally does not ask for a login name.

       ·      Optionally invokes a non-standard login program instead of /bin/login.

       ·      Optionally turns on hard-ware flow control

       ·      Optionally forces the line to be local with no need for carrier detect.

       This program does not use the /etc/gettydefs (System V) or /etc/gettytab (SunOS 4) files.

ARGUMENTS
       port   A path name relative to the /dev directory. If a "-" is specified, agetty assumes that its standard input is  already
              connected to a tty port and that a connection to a remote user has already been established.

              Under System V, a "-" port argument should be preceded by a "--".

       baud_rate,...
              A comma-separated list of one or more baud rates. Each time agetty receives a BREAK character it advances through the
              list, which is treated as if it were circular.

              Baud rates should be specified in descending order, so that the null character (Ctrl-@) can also  be  used  for  baud
              rate switching.

              This argument is optional and unnecessary for virtual terminals.  The default for serial terminals is '9600'.

       term   The  value  to be used for the TERM environment variable. This overrides whatever init(8) may have set, and is inher‐
              ited by login and the shell.

              The default is 'vt100', or 'linux' for Linux on virtual terminal, or 'hurd' for GNU Hurd on virtual terminal.

OPTIONS
       -8, --8bits
              Assume that the tty is 8-bit clean, hence disable parity detection.

       -a, --autologin username
              Log the specified user automatically in without asking for a login name and password. The -f username option is added
              to the /bin/login command line by default. The --login-options option changes this default behaviour and then only \u
              is replaced by the username and no other option is added to the login command line.

              Note that --autologin may affect the way how agetty initializes the serial line, because on  auto-login  agetty  does
              not read from the line and it has no opportunity optimize the line setting.

       -c, --noreset
              Don't reset terminal cflags (control modes). See termios(3) for more details.

       -E, --remote
              If -H fakehost option is given then -r fakehost options is added to the /bin/login command line.

       -f, --issue-file issue_file
              Display  the  contents of issue_file instead of /etc/issue.  This allows custom messages to be displayed on different
              terminals.  The -i option will override this option.
       -h, --flow-control
              Enable hardware (RTS/CTS) flow control. It is left up to the application to disable software (XON/XOFF) flow protocol
              where appropriate.

       -H, --host login_host
              Write  the specified login_host into the utmp file. (Normally, no login host is given, since agetty is used for local
              hardwired connections and consoles. However, this option can be useful for identifying terminal concentrators and the
              like.

       -i, --noissue
              Do  not  display  the  contents of /etc/issue (or other) before writing the login prompt. Terminals or communications
              hardware may become confused when receiving lots of text at the wrong baud rate; dial-up  scripts  may  fail  if  the
              login prompt is preceded by too much text.

       -I, --init-string initstring
              Set  an  initial string to be sent to the tty or modem before sending anything else. This may be used to initialize a
              modem.  Non printable characters may be sent by writing their octal code preceded by a backslash (\). For example  to
              send a linefeed character (ASCII 10, octal 012) write \012.

       -l, --login-program login_program
              Invoke  the  specified login_program instead of /bin/login.  This allows the use of a non-standard login program (for
              example, one that asks for a dial-up password or that uses a different password file).

       -L, --local-line
              Force the line to be a local line with no need for carrier detect. This  can  be  useful  when  you  have  a  locally
              attached terminal where the serial line does not set the carrier detect signal.

       -m, --extract-baud
              Try  to  extract  the baud rate the CONNECT status message produced by Hayes(tm)-compatible modems. These status mes‐
              sages are of the form: "<junk><speed><junk>".  agetty assumes that the modem emits its status  message  at  the  same
              speed as specified with (the first) baud_rate value on the command line.

              Since  the -m feature may fail on heavily-loaded systems, you still should enable BREAK processing by enumerating all
              expected baud rates on the command line.

       -n, --skip-login
              Do not prompt the user for a login name. This can be used in connection with -l option to invoke a non-standard login
              process  such as a BBS system. Note that with the -n option, agetty gets no input from user who logs in and therefore
              won't be able to figure out parity, character size, and newline processing of the connection. It  defaults  to  space
              parity,  7 bit characters, and ASCII CR (13) end-of-line character.  Beware that the program that agetty starts (usu‐
              ally /bin/login) is run as root.

       -o, --login-options "login_options"
              Options  that  are passed to the login program.  \u is replaced by the login name.  The  default  /bin/login  command
              line is "/bin/login -- <username>".

              Please read the SECURITY NOTICE below if you want to use this.

       -p, --login-pause
              Wait  for  any  key  before  dropping to the login prompt.  Can be combined with --autologin to save memory by lazily
              spawning shells.
      -r, --chroot "directory"
              Change root to the specified directory.

       -R, --hangup
              Do call vhangup() for a virtually hangup of the specified terminal.

       -s, --keep-baud
              Try to keep the existing baud rate. The baud rates from the command line are used when agetty receives a BREAK  char‐
              acter.

       -t, --timeout timeout
              Terminate  if  no  user name could be read within timeout seconds. This option should probably not be used with hard-
              wired lines.

       -U, --detect-case
              Turn on support for detecting an uppercase only terminal.  This setting will detect a login name containing only cap‐
              itals  as indicating an uppercase only terminal and turn on some upper to lower case conversions.  Note that this has
              no support for any unicode characters.

       -w, --wait-cr
              Wait for the user or the modem to send a carriage-return or a linefeed character before sending  the  /etc/issue  (or
              other) file and the login prompt. Very useful in connection with the -I option.

       --noclear
              Do not clear the screen before prompting for the login name (the screen is normally cleared).
              Do not print hints about Num, Caps and Scroll Locks.

       --nonewline
              Do not print a newline before writing out /etc/issue.

       --nohostname
              By default the hostname will be printed.  With this option enabled, no hostname at all will be shown.

       --long-hostname
              By  default the hostname is only printed until the first dot.  With this option enabled, the fully qualified hostname
              by gethostname() or (if not found) by getaddrinfo() is shown.

       --erase-chars string
              This option specifies additional characters that should be interpreted as a backspace ("ignore the  previous  charac‐
              ter")  when the user types the login name.  The default additional ´erase´ has been ´#´, but since util-linux 2.23 no
              additional erase characters are enabled by default.

       --kill-chars string
              This option specifies additional characters that should be interpreted as a kill ("ignore all  previous  characters")
              when  the  user types the login name.  The default additional ´kill´ has been ´@´, but since util-linux 2.23 no addi
‐              tional kill characters are enabled by default.

       --version
              Display version information and exit.
       --help Display help text and exit.

EXAMPLES
       This section shows examples for the process field of an entry in the /etc/inittab file.  You'll have to prepend  appropriate
       values for the other fields.  See inittab(5) for more details.

       For a hard-wired line or a console tty:

              /sbin/agetty 9600 ttyS1

       For  a  directly connected terminal without proper carriage detect wiring: (try this if your terminal just sleeps instead of
       giving you a password: prompt.)

              /sbin/agetty -L 9600 ttyS1 vt100

       For a old style dial-in line with a 9600/2400/1200 baud modem:

              /sbin/agetty -mt60 ttyS1 9600,2400,1200

       For a Hayes modem with a fixed 115200 bps interface to the machine: (the example init string turns off modem echo and result
       codes, makes modem/computer DCD track modem/modem DCD, makes a DTR drop cause a dis-connection and turn on auto-answer after
       1 ring.)

              /sbin/agetty -w -I 'ATE0Q1&D2&C1S0=1\015' 115200 ttyS1

SECURITY NOTICE
       If you use the --login-program and --login-options options, be aware that a malicious user may try to  enter  lognames  with
       embedded  options,  which  then get passed to the used login program. Agetty does check for a leading "-" and makes sure the
       logname gets passed as one parameter (so embedded spaces will not create yet another parameter), but depending  on  how  the
       login binary parses the command line that might not be sufficient.  Check that the used login program can not be abused this
       way.

       Some  programs use "--" to indicate that the rest of the commandline should not be interpreted as options. Use this  feature
       if available by passing "--" before the username gets passed by \u.

ISSUE ESCAPES
       The  issue-file (/etc/issue or the file set with the -f option) may contain certain escape codes to display the system name,
       date and time etc. All escape codes consist of a backslash (\) immediately followed by one of the letters explained below.

       4 or 4{interface}
              Insert the IPv4 address of the machine hostname or IPv4 address the configured network  interface  if  the  interface
              argument is specified (e.g. \4{eth0}).

       6 or 6{interface}
              Insert  the  IPv6  address  of the machine hostname or IPv6 address the configured network interface if the interface
              argument is specified (e.g. \6{eth0}}

       b      Insert the baudrate of the current line.

       d      Insert the current date.

       s      Insert the system name, the name of the operating system. Same as `uname -s'.  See also \S escape code.

       S or S{VARIABLE}
              Insert the VARIABLE data from /etc/os-release.  If the VARIABLE argument is not specified then use  PRETTY_NAME  from
              the  file  or the system name (see \s).  This escape code allows to keep /etc/issue distribution and release indepen‐
              dent.  Note that \S{ANSI_COLOR} is converted to the real terminal escape sequence.

       l      Insert the name of the current tty line.

       m      Insert the architecture identifier of the machine. Same as `uname -m'.

       n      Insert the nodename of the machine, also known as the hostname. Same as `uname -n'.

       o      Insert the NIS domainname of the machine. Same as `hostname -d'.

       O      Insert the DNS domainname of the machine.

       r      Insert the release number of the OS. Same as `uname -r'.

       t      Insert the current time.

       u      Insert the number of current users logged in.

       U      Insert the string "1 user" or "<n> users" where <n> is the number of current users logged in.

       v Insert the version of the OS, eg. the build-date etc.
       Example: On my system, the following /etc/issue file:

              This is \n.\o (\s \m \r) \t

       displays as

              This is thingol.orcan.dk (Linux i386 1.1.9) 18:29:30

FILES
       /var/run/utmp
              the system status file.

       /etc/issue
              printed before the login prompt.

       /etc/os-release
              operating system identification data.

       /dev/console
              problem reports (if syslog(3) is not used).

       /etc/inittab
              init(8) configuration file for SysV-style init daemon.

BUGS
       The baud-rate detection feature (the -m option) requires that agetty be scheduled soon enough after completion of a  dial-in

BUGS
       The baud-rate detection feature (the -m option) requires that agetty be scheduled soon enough after completion of a  dial-in
       call  (within 30 ms with modems that talk at 2400 baud). For robustness, always use the -m option in combination with a mul‐
       tiple baud rate command-line argument, so that BREAK processing is enabled.

       The text in the /etc/issue file (or other) and the login prompt are always output with 7-bit characters and space parity.

       The baud-rate detection feature (the -m option) requires that the modem emits its status message after raising the DCD line.

DIAGNOSTICS
       Depending on how the program was configured, all diagnostics are written to the console device or reported via the syslog(3)
       facility.   Error  messages  are produced if the port argument does not specify a terminal device; if there is no utmp entry
       for the current process (System V only); and so on.

AUTHORS
       Werner Fink ⟨werner@suse.de⟩
       Karel Zak ⟨kzak@redhat.com⟩

       The original agetty for serial terminals was written by W.Z. Venema <wietse@wzv.win.tue.nl> and ported  to  Linux  by  Peter
       Orbaek <poe@daimi.aau.dk>.

AVAILABILITY
       The agetty command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/.

util-linux                                                    May 2011                                                    AGETTY(8)
[root@node101.yinzhengjie.org.cn ~]# man 8 agetty     #根据man issue中的提示,我们可以参考agetty相关的参数,找到符合题意的变量

    通过查看帮助信息,在今天18:30自动关机,并提示用户 

1>.查看关机相关命令
    [root@node101.yinzhengjie.org.cn ~]# whatis shutdown
    shutdown (8) - Halt, power-off or reboot the machine                    #我们看到章节8比较符合题意,因此我们需要通过man帮助查看关于shutdown的帮助信息
    shutdown (2) - shut down part of a full-duplex connection
    shutdown (3p) - shut down socket send and receive operations
    [root@node101.yinzhengjie.org.cn ~]#

2>.查找到相关用法后,我们可以直接执行命令:
    [root@node101.yinzhengjie.org.cn ~]# shutdown 18:00 "System will poweroff"       #设置成功后会有相关的提示信息哟~
    Shutdown scheduled for Tue 2019-09-03 18:00:00 CST, use 'shutdown -c' to cancel.
    [root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# man -k shutdown        #搜索man帮助关于shutdown相关词汇
dracut-shutdown.service (8) - unpack the initramfs to /run/initramfs
posix_trace_create (3p) - trace stream initialization, flush, and shutdown from a process (TRACING)
posix_trace_create_withlog (3p) - trace stream initialization, flush, and shutdown from a process (TRACING)
posix_trace_flush (3p) - trace stream initialization, flush, and shutdown from a process (TRACING)
posix_trace_shutdown (3p) - trace stream initialization, flush, and shutdown from a process (TRACING)
shutdown (2)         - shut down part of a full-duplex connection
shutdown (3p)        - shut down socket send and receive operations
shutdown (8)         - Halt, power-off or reboot the machine
systemd-backlight (8) - Load and save the display backlight brightness at boot and shutdown
systemd-backlight@.service (8) - Load and save the display backlight brightness at boot and shutdown
systemd-halt.service (8) - System shutdown logic
systemd-kexec.service (8) - System shutdown logic
systemd-poweroff.service (8) - System shutdown logic
systemd-random-seed (8) - Load and save the system random seed at boot and shutdown
systemd-random-seed.service (8) - Load and save the system random seed at boot and shutdown
systemd-reboot.service (8) - System shutdown logic
systemd-rfkill (8)   - Load and save the RF kill switch state at boot and shutdown
systemd-rfkill@.service (8) - Load and save the RF kill switch state at boot and shutdown
systemd-shutdown (8) - System shutdown logic
systemd-shutdownd (8) - Scheduled shutdown service
systemd-shutdownd.service (8) - Scheduled shutdown service
systemd-shutdownd.socket (8) - Scheduled shutdown service
systemd-update-utmp (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-update-utmp-runlevel.service (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-update-utmp.service (8) - Write audit and utmp updates at bootup, runlevel changes and shutdown
systemd-user-sessions (8) - Permit user logins after boot, prohibit user logins at shutdown
systemd-user-sessions.service (8) - Permit user logins after boot, prohibit user logins at shutdown
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# man -k shutdown        #搜索man帮助关于shutdown相关词汇
[root@node101.yinzhengjie.org.cn ~]# man 8 shutdown            #查看shutdown关机命令相关的帮助信息
SHUTDOWN(8)                                        shutdown                                       SHUTDOWN(8)

NAME
       shutdown - Halt, power-off or reboot the machine

SYNOPSIS
       shutdown [OPTIONS...] [TIME] [WALL...]

DESCRIPTION
       shutdown may be used to halt, power-off or reboot the machine.

       The first argument may be a time string (which is usually "now"). Optionally, this may be followed by
       a wall message to be sent to all logged-in users before going down.

       The time string may either be in the format "hh:mm" for hour/minutes specifying the time to execute
       the shutdown at, specified in 24h clock format. Alternatively it may be in the syntax "+m" referring
       to the specified number of minutes m from now.  "now" is an alias for "+0", i.e. for triggering an
       immediate shutdown. If no time argument is specified, "+1" is implied.

       Note that to specify a wall message you must specify a time argument, too.

       If the time argument is used, 5 minutes before the system goes down the /run/nologin file is created
       to ensure that further logins shall not be allowed.

OPTIONS
       The following options are understood:

       --help
           Print a short help text and exit.

       -H, --halt
           Halt the machine.

       -P, --poweroff
           Power-off the machine (the default).

       -r, --reboot
           Reboot the machine.

       -h
           Equivalent to --poweroff, unless --halt is specified.

       -k
           Do not halt, power-off, reboot, just write wall message.

       --no-wall
          Do not send wall message before halt, power-off, reboot.

       -c            #取消关机
           Cancel a pending shutdown. This may be used cancel the effect of an invocation of shutdown with a
           time argument that is not "+0" or "now".

EXIT STATUS
       On success, 0 is returned, a non-zero failure code otherwise.

SEE ALSO
       systemd(1), systemctl(1), halt(8), wall(1)

systemd 219                                                                                       SHUTDOWN(8)
[root@node101.yinzhengjie.org.cn ~]# man 8 shutdown         #查看shutdown关机命令相关的帮助信息
[root@node101.yinzhengjie.org.cn ~]# date 
Tue Sep  3 14:37:39 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# shutdown 18:00 "System will poweroff"        #我们在今天18:00关闭服务器,我们在引号里面可以设置关闭服务的提示信息
Shutdown scheduled for Tue 2019-09-03 18:00:00 CST, use 'shutdown -c' to cancel.     #这里告诉我们可以使用"shutdown -c"指令去终止服务器关机
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date 090317552019                    #我这里手动修改了服务器时间,为了就是让他早点触发关机的提示
Tue Sep  3 17:55:00 CST 2019

Broadcast message from root@node101.yinzhengjie.org.cn (Tue 2019-09-03 17:55:00 CST):

System will poweroff                                        #看到这一行了没有?这的提示就是我们刚刚在引号里面写的提示信息呢~
The system is going down for power-off at Tue 2019-09-03 18:00:00 CST!

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# date 
Tue Sep  3 17:55:02 CST 2019
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# shutdown -c                        #这里就是终止服务器关机

Broadcast message from root@node101.yinzhengjie.org.cn (Tue 2019-09-03 17:55:12 CST):

The system shutdown has been cancelled at Tue 2019-09-03 17:56:12 CST!            #这里有相应的提示,说服务器关机指令被终止了,还打印出来了终止关机的时间

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# shutdown -c                        #这里就是终止服务器关机

 

九.命令行扩展、被括起来的集合 

1>.单引号和双引号 

[root@node101.yinzhengjie.org.cn ~]# echo '$PATH'              #很显然,单引号的话会原样输出字符,不会对单引号里面的变量进行解释
$PATH
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo "$PATH"              #双引号的话,就可以解释变量
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
[root@node101.yinzhengjie.org.cn ~]# 

2>.命令行扩展:$( ) 或 `` 

[root@node101.yinzhengjie.org.cn ~]# echo "This system's name is $(hostname) "       #很显然,"$()"也可以解释变量
This system's name is node101.yinzhengjie.org.cn 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo "i am `whoami` "                   #除了上面的“$()"可以解释变量,我们还可以使用反引号来解释变量
i am root 
[root@node101.yinzhengjie.org.cn ~]# 

3>.括号扩展:{ } 

[root@node101.yinzhengjie.org.cn ~]# echo file{1,3,5}                      #可以使用枚举的方法
file1 file3 file5
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo file{1..5}                       #取变量1到变量5之间的整数
file1 file2 file3 file4 file5
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo file{1..10..2}                    #取变量1到变量10之间的整数并指定步长为2
file1 file3 file5 file7 file9
[root@node101.yinzhengjie.org.cn ~]# 

 

十.历史命令 

1>.命令行历史 

一.命令行历史概述
  (1)保存你输入的命令历史。可以用它来重复执行命令 
  (2)登录shell时,会读取命令历史文件中记录下的命令~/.bash_history 
  (3)登录进shell后新执行的命令只会记录在缓存中;这些命令会用户退出时“追加”至命令历史文件中 

二.命令行历史的使用方法 

  (1)重复前一个命令,有4种方法 
      重复前一个命令使用上方向键,并回车执行 
      按 !! 并回车执行 
      输入 !-1 并回车执行 
      按 Ctrl+p 并回车执行 
  (2)!:0 执行前一条命令(去除参数) 
  (3)Ctrl + n 显示当前历史中的下一条命令,但不执行 
  (4)Ctrl + j 执行当前命令 
  (5)!n 执行history命令输出对应序号n的命令 
  (6)!-n 执行history历史中倒数第n个命令 
  (7)!string 重复前一个以“string”开头的命令
  (8)!?string 重复前一个包含string的命令
  (9)!string:p 仅打印命令历史,而不执行
  (10)!$:p 打印输出 !$ (上一条命令的最后一个参数)的内容
  (11)!*:p 打印输出 !*(上一条命令的所有参数)的内容
  (12)^string 删除上一条命令中的第一个string
  (13)^string1^string2 将上一条命令中的第一个string1替换为string2
  (14)!:gs/string1/string2 将上一条命令中所有的string1都替换为 string2 
  (15)使用up(向上)和down(向下)键来上下浏览从前输入的命令
  (16)ctrl-r来在命令历史中搜索命令
      (reverse-i-search)`’:
  (17)Ctrl+g:从历史搜索模式退出
  (18)要重新调用前一个命令中最后一个参数
      !$  表示
      Esc, .(点击Esc键后松开,然后点击 . 键)
      Alt+ .(按住Alt键的同时点击 . 键) 

2>.调用历史参数

  (1)command !^   利用上一个命令的第一个参数做cmd的参数 
  (2)command !$   利用上一个命令的最后一个参数做cmd的参数 
  (3)command !*   利用上一个命令的全部参数做cmd的参数 
  (4)command !:n  利用上一个命令的第n个参数做cmd的参数 
  (5)command !n:^ 调用第n条命令的第一个参数 
  (6)command !n:$ 调用第n条命令的最后一个参数 
  (7)command !n:m 调用第n条命令的第m个参数 
  (8)command !n:* 调用第n条命令的所有参数 
  (9)command !string:^ 从命令历史中搜索以 string 开头的命令,并获取它的第一 个参数
  (10)command !string:$ 从命令历史中搜索以 string 开头的命令,并获取它的最后一 个参数
  (11)(command !string:n 从命令历史中搜索以 string 开头的命令,并获取它的第n 个参数
  (12)command !string:* 从命令历史中搜索以 string 开头的命令,并获取它的所有 参数 

3>.命令history

history [-c] [-d offset] [n]  
history -anrw [filename]
history -ps arg [arg...]
  -c: 清空命令历史
  -d offset: 删除历史中指定的第offset个命令
  n: 显示最近的n条历史
  -a: 追加本次会话新执行的命令历史列表至历史文件
  -r: 读历史文件附加到历史列表
  -w: 保存历史列表到指定的历史文件
  -n: 读历史文件中未读过的行到历史列表
  -p: 展开历史参数成多行,但不存在历史列表中
  -s: 展开历史参数成一行,附加在历史列表后
[root@node101.yinzhengjie.org.cn ~]# history           #查看当前命令行中执行的历史命令。
    1  vi /etc/bashrc                         #第一个参数为保存历史命令的编号,第二个参数为执行的历史命令
    2  cat /etc/bashrc 
    3  cat /etc/hostname 
    4  reboot 
    5  vi /etc/hostname 
    6  vi /etc/sysconfig/network-scripts/ifcfg-ens33 
    7  /etc/init.d/network restart
    8  ifconfig 
    9  ping www.baidu.com
   10  ifconfig n
   11  ifconfig 
   12  lscpu 
   13  free 
   14  free -h
   15  lsblk 
   16  ifconfig 
   17  cat /etc/redhat-release 
   18  yum -y install lsb_release
   19  yum search ifconfig
   20  yum search lsb_release
   21  lsblk 
   22  yum search lsb_release
   23  lsb_release
   24  yum install -y redhat-lsb
   25  lsb_release -a
   26  cat /etc/redhat-release 
   27  lsb_release -a
   28  cat /etc/os-release 
   29  uname -re
   30  uname -r
   31  uname -a
   32  hostname
   33  ttp
   34  tty
   35  who
   36  whoami 
   37  who am i
   38  whoami 
   39  free 
   40  init 3
   41  free 
   42  \
   43  runlevel 
   44  init 5
   45  runlevel 
   46  reboot 
   47  cat /etc/redhat-release 
   48  ping www.baidu.com
   49  runlevel 
   50  gedit 
   51  gedit /etc/gdm/custom.conf 
   52  cat /etc/gdm/custom.conf 
   53  cat /etc/redhat-release 
   54  ping www.baidu.com
   55  echo ${SHELL} \
   56  echo ${SHELL} 
   57  cat /etc/shells
   58  cat /etc/hostname 
   59  tty
   60  echo $PS1
   61  PS1="\[\e[1;5;41;33m\][\u@\h \W]\\$\[\e[0m\]" 
   62  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$" 
   63  cat /etc/profile.d/env.sh 
   64  type ls
   65  type echo
   66  enable 
   67  ls -l /bin/bash
   68  hostname
   69  type hostname
   70  type echo
   71  type uname 
   72  type type
   73  hash 
   74  hash -l
   75  echo $PATH
   76  hash 
   77  hash -l
   78  hash -p
   79  hash -p /usr/bin/hostname
   80  hash 
   81  hash -r
   82  hash 
   83  uname -r
   84  hash 
   85  echo $PATH
   86  mv /usr/bin/uname /usr/local/bin/
   87  uname -r
   88  hash -d uname
   89  hash
   90  uname -r
   91  hash
   92  help enable
   93  help 
   94  which -a | --skip-alias
   95  which hostname
   96  which echo
   97  whereis echo
   98  which hostname
   99  whereis hostname
  100  which hostname
  101  whereis hostname
  102  which echo
  103  whereis echo
  104  alias 
  105  date -R
  106  init 0
  107  echo $PS1
  108  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  109  PS1=" \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  110  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  111  PS1="[\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  112  PS1="\[[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  113  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  114  PS1=" \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  115  PS1="[\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  116  PS1="\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  117  PS1="[\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  118  PS1="[\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  119  PS1="[ \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  120  PS1="[\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  121  PS1="[\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  122  PS1="[\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\#"
  123  PS1="[\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  124  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  125  PS1="\[\e[1;32m\][\[\e[0m\][\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$
"  126  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  127  PS1="\[\e[1;32m\][\[\e[0m\][\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$
"  128  PS1="\\e[1;32m\][\[\e[0m\][\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  129  1="\\e[1;32m\][\[\e[0m\][\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  130  PS1="[\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\#"
  131  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  132  1="\\e[1;32m\][\[\e[0m\][\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  133  PS1="\\e[1;32m\][\[\e[0m\][\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  134  1="\\e[1;32m\][\[\e[0m\][\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  135  1="\\e[1;32m\][\[\e[0m\][\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$""\
[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"   136  "\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$" 
  137  cd
  138  "\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$" 
  139  PS1="[\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  140  [\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$
  141  PS1=[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$
  142  PS1="[\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  143  PS1="[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  144  ifconfig 
  145  cat /etc/profile.d/
  146  ll /etc/profile.d/
  147  vi /etc/profile.d/env.sh
  148  echo $PATH
  149  echo $PS1
  150  PS1="[\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  151  PS1="[\t \[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  152  who
  153  whoami 
  154  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\h\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$" 
  155  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\H\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"  
  156  PS1="\[\e[1;32m\][\[\e[0m\]\t [\[\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$
"  157  PS1="\[\e[1;32m\][\[\e[0m\]\t [\e[34;1m\]\u@\[\e[0m\]\[\e[32;1m\]\H\[\e[0m\] \[\e[31;1m\]\w\[\e[0m\]]\$"
  158  PS1="\[\e[1;32m\][\[\e[0m\]\t \[\e[1;33m\]\u\[\e[36m\]@\H\[\e[1;31m\] \W\[\e[1;32m\]]\[\e[0m\]\\$"
  159  cd
  160  vi /etc/profile.d/env.sh
  161  cat /etc/profile.d/env.sh
  162  ifconfig 
  163  cat /etc/redhat-release 
  164  ping www.baidu.com
  165  alias 
  166  date -r
  167  date -R
  168  ifconfig 
  169  cd /etc/sysconfig/network-scripts/
  170  cd
  171  alias cdnet='cd /etc/sysconfig/network-scripts/'
  172  alias 
  173  cdnet 
  174  pwd
  175  cd
  176  ifconfig 
  177  ping www.baidu.com
  178  ifconfig 
  179  cat /etc/redhat-release 
  180  cd
  181  rm -rf /etc/profile.d/env.sh 
  182  ifconfig 
  183  cat /etc/redhat-release 
  184  ping www.baidu]
  185  ifconfig 
  186  ping www.baidu.com
  187  cat /etc/redhat-release 
  188  ifconfig 
  189  \
  190  alias 
  191  alias cdnet='cd /etc/sysconfig/network-scripts/'
  192  alias 
  193  unalias cdnet
  194  alias 
  195  alias cdnet='cd /etc/sysconfig/network-scripts/'
  196  alias cdnet
  197  type cdnet
  198  ifconfig 
  199  enable 
  200  hostname
  201  alias enable=hostname
  202  enable 
  203  cdd
  204  sdsa
  205  type hostname
  206  bc
  207  python
  208  ifconfig 
  209  cat /etc/os-release 
  210  ifconfig 
  211  enable 
  212  alias 
  213  cat /etc/redhat-release 
  214  cat /etc/os-release 
  215  alias 
  216  pwd
  217  cat .bashrc 
  218  vi .bashrc 
  219  cat .bashrc 
  220  vi .bashrc 
  221  alias 
  222  source .bashrc 
  223  alias 
  224  cat .bashrc 
  225  vi /etc/bashrc 
  226  tail -2 /etc/bashrc 
  227  . /etc/bashrc 
  228  alias 
  229  alias -a
  230  alias 
  231  unalias -a
  232  alias 
  233  hostname
  234  alias cd=hostname
  235  cd
  236  'cd' /etc/sysconfig/network-scripts/
  237  \cd /etc/
  238  unalias cd
  239  cd /root/
  240  alias 
  241  which ls
  242  which --skip-aliase ls
  243  alias 
  244  which ls
  245  which --skip-alias ls
  246  \which  ls
  247  'which'  ls
  248  id -o
  249  id -u
  250  ls -g
  251  id -u
  252  free -h
  253  uname -r
  254  id -u
  255  free -h
  256  fdisk -l
  257  free 
  258  man free 
  259  free --si
  260  man free 
  261  free --peta
  262  free --peta --si
  263  free --si
  264  ls --all
  265  which --skip-alias pwd
  266  a
  267  ip a
  268  ps aux
  269  file anaconda-ks.cfg 
  270  rz -E
  271  file anaconda-ks.cfg 
  272  ls
  273  file anaconda-ks.cfg 
  274  file Notepad++.lnk 
  275  file anaconda-ks.cfg 
  276  id -u yinzhengjie
  277  alias ls
  278  man alias
  279  alias  -l
  280  file anaconda-ks.cfg 
  281  id -u yinzhengjie
  282  bc
  283  free 
  284  free ;hostname
  285  free ;hostname;ifconfig ens33
  286  free ;hostname;ifconfig
  287  hostname
  288  cat /etc/sysconfig/network-scripts/ ifcf-ens33
  289  hostname
  290  hostname
  291  whatis 
  292  whatis ls
  293  whatis RM
  294  whatis rm
  295  whatis uname
  296  whatis cal
  297  mandb 
  298  whatis date
  299  type data
  300  type date
  301  type echo
  302  help
  303  help echo
  304  date 
  305  help date
  306  echo --help
  307  type echo
  308  type date
  309  help date
  310  help echo 
  311  type help
  312  echo \a
  313  echo "\a"
  314   
  315  echo "\a"
  316  echo -e "\a"
  317  echo -e \a
  318  echo -e "\a"
  319  echo "abc\bxyz"
  320  echo -e "abc\bxyz"
  321  echo -e "abc"
  322  echo -e "abc\c"
  323  echo -e "abc\n123\nxyz"
  324  echo -e "abc\f123"
  325  echo -e "abcd\f123"
  326  echo -e "abcd\f123\fxyz"
  327  echo -e "abc\t123"
  328  echo -e "abc\t123\txyz"
  329  echo -e "yinzhengjie\t2019\tjason"
  330  echo -e "yinzhengjie\t2019\tjason\n123\t456\789"
  331  echo -e "yinzhengjie\t2019\tjason\n123\t456\t789"
  332  echo -e "yinzhengjie\t2019\tjason"
  333  echo -e "yinzhengjie\v2019\vjason"
  334  echo -e "yinzhengjie\v2019\vjason" | wc -l
  335  echo -e "yinzhengjie\f2019\fjason"
  336  echo -e "yinzhengjie\f2019\fjason" | wc -l
  337  echo -e "yinzhengjie\e2019\fjason" | wc -l
  338  echo -e "yinzhengjie\e2019\fjason" 
  339  echo -e "yinzhengjie\f2019\fjason" 
  340  echo -e "yinzhengjie\f2019\ejason" 
  341  echo -e "yinzhengjie\f2019\fjason" 
  342  echo -e "yinzhengjie\f2019\rjason" 
  343  echo -e "yinzhengjie\r2019\rjason" 
  344  echo -e "yinzhengjie\r2019" 
  345  echo -e "\\" 
  346  man assci
  347  man ascii
  348  kk
  349  ll
  350  ll Videos/
  351  rm -rf *
  352  ll
  353  ifconfig 
  354  nano a.txt
  355  vi a.txtm 
  356  ll
  357  rm -rf a.txtm 
  358  ll
  359  vi a.txt
  360  cat a.txt
  361  hexdump a.txt 
  362  cat a.txt 
  363  hexdump a.txt 
  364  file a.txt 
  365  cat a.txt 
  366  hexdump a.txt 
  367  hexdump -C a.txt 
  368  vi b.txt
  369  cat b.txt
  370  file b.txt
  371  cat b.txt 
  372  hexdump -C b.txt 
  373  hexdump  b.txt 
  374  echo $LANG
  375  man 7 charset
  376  man 7 charsets
  377  iconv -l
  378  echo -e "\0101"
  379  echo -e "\0102"
  380  echo -e "\0103"
  381  \
  382  echo -e "\x103"
  383  echo -e "\x41"
  384  echo -e "\x42"
  385  echo -e "\x43"
  386  date 
  387  date  --help
  388  help date
  389  date 
  390  date -u
  391  date -R
  392  timedatectl 
  393  timedatectl list-timezones 
  394  date -R
  395  date 
  396  date -R
  397  timedatectl set-timezone America/New_York
  398  date -R
  399  date 
  400  date -u
  401  ll /etc/localtime 
  402  date -R
  403  date 
  404  timedatectl set-timezone Asia/Shanghai
  405  date 
  406  date -R
  407  ll /etc/localtime 
  408  loca
  409  echo $Lang
  410  echo $LANG
  411  localectl 
  412  localectl list-locales 
  413   
  414  ll
  415  echo $LANG
  416  localectl set-locale LANG= zh_CN.utf8
  417  echo $LANG
  418  localectl set-locale LANG=zh_CN.utf8
  419  echo $LANG
  420  localectl set-locale en_US.UTF-8
  421  localectl set-locale LANG=en_US.UTF-8
  422  echo $LANG
  423  date %F
  424  date %Y
  425  date +%Y
  426  date +%H
  427  date +%d
  428  date 
  429  date +%Y-%m-%d
  430  date +%F
  431  date +%T
  432  date "+%F %T"
  433  date +%F_%T
  434  date --help
  435  ] [MMDDhhmm[[CC]YY][.ss]]
  436  date 080312243030.30
  437  date 
  438  date --help
  439  [MMDDhhmm[[CC]YY][.ss]]
  440  date 
  441  date 080312242019.30
  442  date 
  443  ifconfig 
  444  ping www.baidu.com
  445  clock
  446  date 
  447  clock
  448  clock -s
  449  date 
  450  clock
  451  date 
  452  clock
  453  date 080412242019.30
  454  date 
  455  clock
  456  date 
  457  clock
  458  clock -w
  459  date 
  460  clock
  461  date 
  462  date -d "yesterday"
  463  date -d "yesterday" +%F
  464  date -d "tomorrow" +%F
  465  date -d "-20 days" +%F
  466  date -d "30 days" +%F
  467  date 
  468  date -s "30 days" +%F
  469  date 
  470  date +%s
  471  ll -h
  472  ll -s
  473  ll -h
  474  ls
  475  cal --help
  476  cal 2020
  477  cal 8  2020
  478  cal -y
  479  cal 
  480  date 
  481  ifconfig 
  482  cat /etc/redhat-release 
  483  ping www.baidu.co
  484  ping www.baidu.com
  485  whereis da
  486  whereis date
  487  cat /usr/share/man/man1/date.1.gz 
  488  XshellXshellXshellXshellXshellXshellXshellXshellXshellXshellXshellXshellXshellXshell
  489  man date
  490  ]
  491  man date
  492  which passwd
  493  whereis passwd
  494  whatis passwd
  495  man 5 passwd
  496  man 1 passwd
  497  man  passwd
  498  man 5 passwd
  499  man man
  500  \
  501  whatis man
  502  man 7 man
  503  vi /etc/motd 
  504  cat /etc/motd 
  505  vi /etc/motd 
  506  cat /etc/motd 
  507  ping 127.0.0.1
  508   
  509  vi /etc/issue
  510  cat /etc/issue
  511  whereis passwd
  512  man -w passwd
  513  man -w 5 passwd
  514  man ls
  515  uname -n
  516  cat /etc/os-release 
  517  whatis issue
  518  man issue
  519  whatis agetty
  520  man 8 agetty
  521  vi /etc/issue
  522  cat /etc/issue
  523  man -k shutdown
  524  whatis shutdown
  525   
  526  l
  527  man 8 shutdown
  528  date 
  529  shutdown 18:00 "System will poweroff"
  530  date 090317552019
  531  date 
  532  shutdown -c
  533   
  534  info ls
  535  info 
  536  info pwd
  537  info 
  538  ll /usr/share/doc/
  539   
  540  ll /usr/share/doc/ |wc -l
  541  ll /usr/share/doc/ | grep lrzsz
  542  ll /usr/share/doc/ | grep bc
  543  ll /usr/share/doc/ | grep bc-1.06.95
  544  l
  545  ll /usr/share/doc/ |wc -l
  546  ll /usr/share/doc/ | grep bc-1.06.95
  547  ll /usr/share/doc/bc-1.06.95/
  548  echo '$PATH'
  549  echo "$PATH"
  550  echo "This system's name is $(hostname) " 
  551  echo "i am `whoami` " 
  552  echo file{1,3,5\
  553  echo file{1,3,5}
  554  echo file{1..5}
  555  echo file{a..z}
  556  echo file{1,3,5}
  557  echo file{1..5}
  558  echo file{1..10..2}
  559  w
  560  who
  561  whoami 
  562  who
  563  lsblk 
  564  rmp -ivh /run/media/root/CentOS\ 7\ x86_64/Packages/screen-4.1.0-0.25.20120314git3c2946.el7.x86_64.rpm 
  565  lsblk 
  566  rpm -ivh /run/media/root/CentOS\ 7\ x86_64/Packages/screen-4.1.0-0.25.20120314git3c2946.el7.x86_64.rpm 
  567  screen 
  568  who
  569  screen 
  570  who
  571  exit 
  572  who
  573  exit 
  574  screen -S help_me
  575  screen -l
  576  screen -l
  577  echo $LANG
  578  cat /etc/issue
  579  cat /etc/motd 
  580  who
  581  ss -ntl
  582  screen -ls
  583  ps -ef | grep ping
  584  ps -ef | grep ping | grep -v grep
  585  ps -ef | grep ping
  586  \
  587  screen -ls
  588  screen -r
  589  screen -l
  590  who
  591  screen -l
  592  ps -ef | grep ping
  593  screen -l
  594  who
  595  ls
  596  who
  597  screen -ls
  598  screen -x help_me
  599  who
  600  ifconfig 
  601  history 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# history           #查看当前命令行中执行的历史命令。
[root@node101.yinzhengjie.org.cn ~]# history           #查看当前命令行中执行的历史命令。
  ...... 
  588  screen -r
  589  screen -l
  590  who
  591  screen -l
  592  ps -ef | grep ping
  593  screen -l
  594  who
  595  ls
  596  who
  597  screen -ls
  598  screen -x help_me
  599  who
  600  ifconfig 
  601  history 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# !600            #执行history中记录的第600条命令
ifconfig 
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.30.1.101  netmask 255.255.255.0  broadcast 172.30.1.255
        inet6 fe80::20c:29ff:febe:114d  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:be:11:4d  txqueuelen 1000  (Ethernet)
        RX packets 215554  bytes 280803323 (267.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 33311  bytes 4107126 (3.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 860  bytes 74340 (72.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 860  bytes 74340 (72.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:a9:de:9b  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# !600            #执行history中记录的第600条命令
[root@node101.yinzhengjie.org.cn ~]# history           #查看当前命令行中执行的历史命令。
  ...... 
  589  screen -l
  590  who
  591  screen -l
  592  ps -ef | grep ping
  593  screen -l
  594  who
  595  ls
  596  who
  597  screen -ls
  598  screen -x help_me
  599  who
  600  ifconfig 
  601  history 
  602  ifconfig 
  603  history 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# !-5            #执行倒数第5条的历史命令。或者你按键盘的上键按5次也可以~
who
root     :0           2019-08-02 16:30 (:0)
root     pts/0        2019-08-02 16:37 (:0)
root     pts/2        2019-09-03 19:49 (172.30.1.1)
root     pts/5        2019-09-03 19:49 (172.30.1.1:S.0)
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# !-5            #执行倒数第5条的历史命令。或者你按键盘的上键按5次也可以~
[root@node101.yinzhengjie.org.cn ~]# history 
  ......
  601  history 
  602  ifconfig 
  603  history 
  604  who
  605  echo $HISTSIZE
  606  set HISTSIZE=20
  607  echo $HISTSIZE
  608  set $HISTSIZE=20
  609  echo $HISTSIZE
  610  cat ~/.bash_history 
  611  cat ~/.bash_history | wc -l
  612  history 
  613  cat ~/.bash_history | wc -l
  614  history 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# rm -rf ~/.bash_history         #删除存放历史命令的文件
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# history -c                #清空内存中的history命令,
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# history                   #我们发现命令被情况啦!
    1  history 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# logout                  #退出当前终端,推出后,内存中保存的history命令会被重新刷新到"~/.bash_history"文件中,我设置了自动重连,连接后我们继续观察历史命令

Connection closed by foreign host.

Disconnected from remote host(node101.yinzhengjie.org.cn) at 17:29:20.

Type `help' to learn how to use Xshell prompt.
[c:\~]$ 
Reconnecting in 1 seconds. Press any key to exit local shell.
.

Host 'node101.yinzhengjie.org.cn' resolved to 172.30.1.101.
Connecting to 172.30.1.101:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Last login: Tue Sep  3 20:30:46 2019 from 172.30.1.1
welcome to https://www.cnblogs.com/yinzhengjie/    !!!
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# history                 #再次查看,发现之前的历史命令都不存在啦
    1  history 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# rm -rf ~/.bash_history         #删除存放历史命令的文件

4>.命令历史相关环境变量 

  HISTSIZE:命令历史记录的条数 
  HISTFILE:指定历史文件,默认为~/.bash_history
  HISTFILESIZE:命令历史文件记录历史的条数
  HISTTIMEFORMAT=“%F %T “ 显示时间 HISTIGNORE=“str1:str2*:… “ 忽略str1命令,str2开头的历史
  控制命令历史的记录方式:
    环境变量:HISTCONTROL
      ignoredups 默认,忽略重复的命令,连续且相同为“重复”
      ignorespace 忽略所有以空白开头的命令
      ignoreboth 相当于ignoredups, ignorespace的组合
      erasedups 删除重复命令
  export 变量名="值“
  存放在 /etc/profile 或 ~/.bash_profile
[root@node101.yinzhengjie.org.cn ~]# echo $HISTSIZE              #历史默认是保存1000条
1000
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# grep HISTSIZE /etc/profile        #我们通过查看"/etc/profile"文件不难发现的确定义的HISTSIZE为1000
HISTSIZE=1000
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# sed -i 's/HISTSIZE=1000/HISTSIZE=20/' /etc/profile      #我们将"HISTSIZE"的大小改为20,为了安全起见。
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# grep HISTSIZE /etc/profile        #发现配置文件被改动了
HISTSIZE=20
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# echo $HISTSIZE                #配置文件被改动了没错,但是并没有立即生效呢
1000
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# source /etc/profile            #于是我们需要重新加载配置文件内容
[root@node101.yinzhengjie.org.cn ~]#   
[root@node101.yinzhengjie.org.cn ~]# echo $HISTSIZE                #Duang~至此我们修改成功啦~
20
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# sed -i 's/HISTSIZE=1000/HISTSIZE=20/' /etc/profile      #我们将"HISTSIZE"的大小改为20,为了安全起见。
[root@node101.yinzhengjie.org.cn ~]# cat /etc/profile.d/env.sh     #我们建议将系统环境变量配置保存到一个指定的文件中,自定义history的输出格式
#!/usr/bin/env python
#_*_conding:utf-8_*_
#@author :yinzhengjie
#blog:http://www.cnblogs.com/yinzhengjie


HISTTIMEFORMAT="%F %T "                            #就这一行命令是有效的,我们给当前的命令添加时间,可以记录命令在何时指定的命令的
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# history                #查看当前的历史命令记录
    3  2019-09-03 20:46:48 who
    4  2019-09-03 20:46:48 screen -l
    5  2019-09-03 20:46:48 who
    6  2019-09-03 20:46:48 ifconfig 
    7  2019-09-03 20:46:48 history 
    8  2019-09-03 20:46:48 cat /etc/redhat-release 
    9  2019-09-03 20:46:48 history 
   10  2019-09-03 20:46:48 #!/usr/bin/env python
   11  2019-09-03 20:46:48 #_*_conding:utf-8_*_
   12  2019-09-03 20:46:48 #@author :yinzhengjie
   13  2019-09-03 20:46:48 cat /etc/profile.d/env.sh 
   14  2019-09-03 20:46:48 pwd
   15  2019-09-03 20:46:48 history 
   16  2019-09-03 20:46:48 cat /etc/profile.d/env.sh 
   17  2019-09-03 20:46:48 HISTTIMEFORMAT=“%F %T\
   18  2019-09-03 20:46:48 HISTTIMEFORMAT=“%F %T
   19  2019-09-03 20:46:48 vi /etc/profile.d/env.sh 
   20  2019-09-03 20:46:50 history 
   21  2019-09-03 20:47:00 cat /etc/profile.d/env.sh 
   22  2019-09-03 20:47:14 history 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cat ~/.bash_history         #查看配置文件中记录的历史命令
who
screen -S help_me
who
screen -l
who
ifconfig 
history 
cat /etc/redhat-release 
history 
#!/usr/bin/env python
#_*_conding:utf-8_*_
#@author :yinzhengjie
cat /etc/profile.d/env.sh 

pwd
history 
cat /etc/profile.d/env.sh 
HISTTIMEFORMAT=“%F %T\
HISTTIMEFORMAT=“%F %T
vi /etc/profile.d/env.sh 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# cat /etc/profile.d/env.sh     #我们建议将系统环境变量配置保存到一个指定的文件中,自定义history的输出格式

 

十一.dmidecode常用参数详解

1>.参数:-s,只显示指定DMI字符串的信息(DMI即DesktopManagement Interface, 就是通过关键字收集电脑系统信息的管理系统)

[root@node101.yinzhengjie.org.cn ~]# dmidecode -s system-uuid      #比如获取服务器的唯一标识:UUID
9ccdf621-e598-4f3b-8626-614f6fa15a48
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# dmidecode -s bios-version     #比如获取服务器的bios版本信息
VirtualBox
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 


其它参数:
  Valid string keywords are:
  bios-vendor
  bios-version
  bios-release-date
  system-manufacturer
  system-product-name
  system-version
  system-serial-number
  system-uuid
  baseboard-manufacturer
  baseboard-product-name
  baseboard-version
  baseboard-serial-number
  baseboard-asset-tag
  chassis-manufacturer
  chassis-type
  chassis-version
  chassis-serial-number
  chassis-asset-tag
  processor-family
  processor-manufacturer
  processor-version
  processor-frequency

2>.参数:-q,简化输出所有的硬件以及软件的信息

[root@node101.yinzhengjie.org.cn ~]# dmidecode -q | wc -l
53
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# dmidecode -q
BIOS Information
    Vendor: innotek GmbH
    Version: VirtualBox
    Release Date: 12/01/2006
    Address: 0xE0000
    Runtime Size: 128 kB
    ROM Size: 128 kB
    Characteristics:
        ISA is supported
        PCI is supported
        Boot from CD is supported
        Selectable boot is supported
        8042 keyboard services are supported (int 9h)
        CGA/mono video services are supported (int 10h)
        ACPI is supported

System Information
    Manufacturer: innotek GmbH
    Product Name: VirtualBox
    Version: 1.2
    Serial Number: 0
    UUID: 9ccdf621-e598-4f3b-8626-614f6fa15a48
    Wake-up Type: Power Switch
    SKU Number: Not Specified
    Family: Virtual Machine

Base Board Information
    Manufacturer: Oracle Corporation
    Product Name: VirtualBox
    Version: 1.2
    Serial Number: 0
    Asset Tag: Not Specified
    Features:
        Board is a hosting board
    Location In Chassis: Not Specified
    Type: Motherboard

Chassis Information
    Manufacturer: Oracle Corporation
    Type: Other
    Lock: Not Present
    Version: Not Specified
    Serial Number: Not Specified
    Asset Tag: Not Specified
    Boot-up State: Safe
    Power Supply State: Safe
    Thermal State: Safe
    Security Status: None

OEM Strings
    String 1: vboxVer_6.0.8
    String 2: vboxRev_130520

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# dmidecode -q | wc -l

3>.参数:-t,只显示指定类型的条目

[root@node101.yinzhengjie.org.cn ~]# dmidecode -t system
# dmidecode 3.1
Getting SMBIOS data from sysfs.
SMBIOS 2.5 present.

Handle 0x0001, DMI type 1, 27 bytes
System Information
    Manufacturer: innotek GmbH
    Product Name: VirtualBox
    Version: 1.2
    Serial Number: 0
    UUID: 9ccdf621-e598-4f3b-8626-614f6fa15a48
    Wake-up Type: Power Switch
    SKU Number: Not Specified
    Family: Virtual Machine

[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# dmidecode -t system
[root@node101.yinzhengjie.org.cn ~]# dmidecode -t biso
Invalid type keyword: biso
Valid type keywords are:
  bios
  system
  baseboard
  chassis
  processor
  memory
  cache
  connector
  slot
[root@node101.yinzhengjie.org.cn ~]# 
[root@node101.yinzhengjie.org.cn ~]# 


常用类型的参数:
  bios
  system
  baseboard
  chassis
  processor
  memory
  cache
  connector
  slot

4>.查看帮助信息

[root@node101.yinzhengjie.org.cn ~]# dmidecode -h
Usage: dmidecode [OPTIONS]
Options are:
 -d, --dev-mem FILE     Read memory from device FILE (default: /dev/mem)          #从设备文件中读取信息,输出文件内容与不加参数相同
 -h, --help             Display this help text and exit                 #显示帮助信息
 -q, --quiet            Less verbose output                          #简化信息输出
 -s, --string KEYWORD   Only display the value of the given DMI string        #只显示指定DMI字符串的信息(DMI即DesktopManagement Interface, 就是通过关键字收集电脑系统信息的管理系统)
 -t, --type TYPE        Only display the entries of given type              #只显示指定类型的条目
 -u, --dump             Do not decode the entries                     #显示不解码的条目
     --dump-bin FILE    Dump the DMI data to a binary file
     --from-dump FILE   Read the DMI data from a binary file
     --no-sysfs         Do not attempt to read DMI data from sysfs files
     --oem-string N     Only display the value of the given OEM string
 -V, --version          Display the version and exit                    #显示版本信息
[root@node101.yinzhengjie.org.cn ~]# 

 

十二.Bash的快捷键

  Ctrl + l 清屏,相当于clear命令 
  Ctrl + o 执行当前命令,并重新显示本命令 
  Ctrl + s 阻止屏幕输出,锁定 
  Ctrl + q 允许屏幕输出 
  Ctrl + c 终止命令 
  Ctrl + z 挂起命令 
  Ctrl + a 光标移到命令行首,相当于Home 
  Ctrl + e 光标移到命令行尾,相当于End 
  Ctrl + f 光标向右移动一个字符 
  Ctrl + b 光标向左移动一个字符 
  Alt + f 光标向右移动一个单词尾 
  Alt + b 光标向左移动一个单词首 
  Ctrl + xx 光标在命令行首和光标之间移动 
  Ctrl + u 从光标处删除至命令行首 
  Ctrl + k 从光标处删除至命令行尾 
  Alt + r      删除当前整行 
  Ctrl + w 从光标处向左删除至单词首 
  Alt + d 从光标处向右删除至单词尾 
  Ctrl + d 删除光标处的一个字符 
  Ctrl + h 删除光标前的一个字符 
  Ctrl + y 将删除的字符粘贴至光标后 
  Alt + c 从光标处开始向右更改为首字母大写的单词 
  Alt + u 从光标处开始,将右边一个单词更改为大写 
  Alt + l 从光标处开始,将右边一个单词更改为小写 
  Ctrl + t 交换光标处和之前的字符位置 
  Alt + t 交换光标处和之前的单词位置 
  Alt + N 提示输入指定字符后,重复显示该字符N次 
  

  注意:Alt组合快捷键经常和其它软件冲突

 

posted @ 2019-08-01 12:58  尹正杰  阅读(1312)  评论(0编辑  收藏  举报