Small commands for linux beginners

Small commands for linux beginners

1. Before formally learning linux commands, you need to know how commands are executed in the linux environment

The shell is a software belonging to the linux kernel, which is loaded into the RAM (memory) after the system starts, and will run after each user logs in to the system through the terminal. Responsible for continuously receiving user input, creating a new 'process' to run the command input by the user, and returning to wait for new command input after execution.

  • Process : A process is a process of dynamic execution of a program with certain independent functions on a data set. It is an independent unit for resource allocation and scheduling by the operating system and a carrier for application programs to run.

For example: Below we first execute the pwd command, bash prints the current location of the user (here is the /root folder); then executes the ls command, bash then displays all visible folders under the current /root directory and files (hidden files under linux start with a dot., you can use 'ls -a' to see), the following uses the * sign to match all files and folders starting with D.

[root@centos7 ~]$pwd
/root
[root@centos7 ~]$ls
anaconda-ks.cfg  Desktop  Documents  Downloads  initial-setup-ks.cfg  Music  Pictures  Public  Templates  Videos
[root@centos7 ~]$ls D*
Desktop:
Documents:
Downloads:

The process of bash executing commands, take the 'ls' command as an example:

The first step. Read input information : the shell gets the user's input information (command ls) through the getline() function of STDIN (standard input) and saves it in a string ("ls"). Then the string is parsed and stored in an array (similar to {"ls", "NULL"}), which stores all the information for the kernel to execute the command.
Step 2. Determine the alias : the shell will check the command alias (user-defined command alias) before searching for the command. If ls is an alias of a command, the shell executes ls directly.
Step 3. Determine whether it is built-in : the shell checks whether the command is a built-in command of the shell (loaded into memory with the shell, ready to run at any time), if it is a built-in command, run the command directly in the context of the shell itself .
Step 4. Search in the hash : If a non-internal command has been executed, the access path of the command is recorded in the hash, and the shell does not need to go to the folder recorded in the PATH environment variable when the command is run next time Search for the executable file of the command.
Step 5. Search in the PATH environment variable : If the command is not a shell built-in command, the shell will go to the file path represented by the PATH environment variable to search for the executable binary file of the command. After finding it, the shell will copy some of its context configurations and generate a subshell process to run the command. At this time, the shell running the command is the subshell process, and the shell that entered the command before is the parent process.

  • PATH : In linux, the PATH environment variable is used to store folders containing executable binary files. These folder names are separated by semicolons:, as shown below, the PATH environment variable on my computer stores the string "/usr/lib64/ qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/", this string indicates that all non-built-in commands in my linux are in These semicolon-separated folders.
[root@centos7 ~]$echo $PATH
/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
  • The following is a list of some executable files under the folder /usr/bin/
  • PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/
[root@centos7 ~]$ls /usr/bin/
[                                    diff                          gtk-query-immodules-2.0-64   mmount                     python2.7                swig
a2p                                  diff3                         gtk-query-immodules-3.0-64   mmove                      qdbus                    sx
abrt-action-analyze-backtrace        diff-jars                     gtk-update-icon-cache        mobj_dump                  qemu-ga                  sync
abrt-action-analyze-c                diffpp                        gtroff                       modifyrepo                 qemu-img                 synclient
abrt-action-analyze-ccpp-local       diffstat                      gucharmap                    modutil                    qemu-io                  syndaemon
abrt-action-analyze-core             dig                           gunzip                       mokutil                    qemu-nbd                 sy
  • The shell executes the command process in a nutshell:

Alias—>Internal command—>Hash recorded external command—>$PATH


2. Small commands for Linux beginners

[alias] define or display an alias

  • usage:
> alias [alias-name[=string] ...]
EXAMPLES 
        1. Change ls to give a columnated, more annotated output:

           alias ls="ls -CF"

        2. Create a simple "redo" command to repeat previous entries in the command history file:

           alias r='fc -s'

        3. Use 1K units for du:

           alias du=du\ -k

        4. Set up nohup so that it can deal with an argument that is itself an alias name:

           alias nohup="nohup "

[bc] calculator

  • bc is a language with interactive execution statements that supports arbitrary precision numbers. In linux, bc can be used for interactive mathematical calculations. It contains many expressions and usages of mathematical calculations. A simple example is as follows:
[root@centos7 ~]$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'. 
1+1
2
2*3
6
4/5
0
5/4
1
3%5
3

[tac] output in reverse order from the last line when the output is displayed

[rev] Reverse the order of characters on each line

[cat] concatenate files and print

  • Concatenate files and print the file content on standard output, usage:
> cat [OPTION]... [FILE]..
  • Without parameters or followed by a minus sign (-) means to copy and print standard input to standard output
[root@centos7 ~]$cat    # cat - 也可以
123                     # 输入123,回车
123                     # 回车后标准输入(123)被打印到标准输出
ABC
ABC
hello world
hello world
^C                      # ctrl + c 强制退出
[root@centos7 ~]$
  • with parameters

-A, --show-all

Equivalent to -vET, display Tab control character ^I and line terminator

[root@centos7 /data]$cat -vET
gg
gg$                         #标注输入为gg
gg	
gg^I$                       #标准输入为gg和tab键
                            #无标准输入,按enter键
$
ddff		                
ddff^I^I$                   #标准输入为ddff和两个tab键

-b, --number-nonblank

record the line number of non-empty input

[root@centos7 /data]$cat -b
123
     1	123            #第一次标准输入内容
222
     2	222            #第二次标准输入内容
asdfw
     3	asdfw
dfbsg4
     4	dfbsg4
3242g
     5	3242g

                        #标准输入为空,未记录
ffff
     6	ffff






fffff
     7	fffff

-e

Equivalent to -vE

-E, --show-ends

Show newline $ on each line

-n, --number

show all stdout lines

[root@centos7 /data]$cat -n
hello
     1	hello
hi
     2	hi
whats up
     3	whats up
nothing
     4	nothing

     5	                         # 第五次标准输入无输入,也记录行号
	
     6		

-s, --squeeze-blank

Compress repeated blank lines, the blank lines after the first blank line do not display anything ($ nor display) on the standard output when there is no input,

[root@centos7 /data]$cat -sA
dd
dd$
ddff	
ddff^I$

$                                  # 第一个空白行的输出
                                   # 后面的空白行被压缩,换行符$也不显示
                                   # 同上

-t

Equivalent to -vT
-T, --show-tabs
shows TAB characters as ^I

-u

ignore tabs and newlines

-v, --show-nonprinting

Display non-printable characters, use with -E, -T, such as: cat -vET

If cat is not followed by a file or a bar - (minus sign), it means reading standard input

[cd] switch working folder

  • The cd command is a shell built-in type, which belongs to the bash built-in command and is used to switch the user's working directory, for example:
[root@centos7 /data/test]$pwd
/data/test                                   # 当前所处位置
[root@centos7 /data/test]$cd /               # / 表示系统根目录 
[root@centos7 /]$pwd
/
[root@centos7 /]$ls                          # 显示根目录文件
bin  boot  data  dev  etc  home  lib  lib64  media  mnt  opt  proc  root  run  sbin  srv  sys  tmp  usr  var
[root@centos7 /]$cd -                        # cd - 表示切换到前一个工作目录 
/data/test
[root@centos7 /data]$cd ~                    # cd ~ 表示切换到家目录
[root@centos7 ~]$cd /data/
[root@centos7 /data]$cd ..                   # cd .. 表示切换到目前所处目录的父目录
[root@centos7 /]$cd .                        # . 一个点表示当前目录
[root@centos7 /]$

[df] report file system disk space usage

  • Without parameters, the default df displays the space usage of all file systems
[root@centos7 ~]$df
Filesystem     1K-blocks    Used Available Use% Mounted on
devtmpfs          747304       0    747304   0% /dev
tmpfs             763104       0    763104   0% /dev/shm
tmpfs             763104   10516    752588   2% /run
tmpfs             763104       0    763104   0% /sys/fs/cgroup
/dev/sda2      104806400 5169652  99636748   5% /
/dev/sda3       52403200   32996  52370204   1% /data
/dev/sda1        1038336  171704    866632  17% /boot
tmpfs             152624      12    152612   1% /run/user/42
tmpfs             152624       0    152624   0% /run/user/0

By default, df takes the block size of 1K as the display unit,

Displayed unit size acquisition sequence: –block-size (user-specified)–>DF_BLOCK_SIZE–>BLOCK_SIZ–>BLOCKSIZE–>1024 bytes (or 512 bytes when the POSIXLY_CORRECT variable has been set)

-a, --all

Show all filesystems, including inaccessible ones

-B, --block-size=SIZE

Specifies the display unit size

SIZE is an integer and optional unit (example: 10M is 10*1024*1024).  
Units are K, M, G, T, P, E, Z, Y (powers of 1024) or KB, MB, ... (powers of 1000).

-h, --human-readable

Use a human-readable format to display the size of the space (eg: 1K 234M 2G), at this time 1M=1024K

-H, --you

Same as -h, except that 1M=1000K at this time, the value of this option is too large

-i, --inodes

Do not display space usage, but display inode usage

[root@centos7 ~]$df -i
Filesystem       Inodes  IUsed    IFree IUse% Mounted on
devtmpfs         186826    402   186424    1% /dev
tmpfs            190776      1   190775    1% /dev/shm
tmpfs            190776    921   189855    1% /run
tmpfs            190776     16   190760    1% /sys/fs/cgroup
/dev/sda2      52428800 162818 52265982    1% /
/dev/sda3      26214400      5 26214395    1% /data
/dev/sda1        524288    340   523948    1% /boot
tmpfs            190776      9   190767    1% /run/user/42
tmpfs            190776      1   190775    1% /run/user/0

-k

Equivalent to --block-size=1K

-l, --local

Restrict display to local filesystem only

-T

show filesystem

[root@centos7 ~]$df -T
Filesystem     Type     1K-blocks    Used Available Use% Mounted on
devtmpfs       devtmpfs    747304       0    747304   0% /dev
tmpfs          tmpfs       763104       0    763104   0% /dev/shm
tmpfs          tmpfs       763104   10516    752588   2% /run
tmpfs          tmpfs       763104       0    763104   0% /sys/fs/cgroup
/dev/sda2      xfs      104806400 5169704  99636696   5% /
/dev/sda3      xfs       52403200   32996  52370204   1% /data
/dev/sda1      xfs        1038336  171704    866632  17% /boot
tmpfs          tmpfs       152624      12    152612   1% /run/user/42
tmpfs          tmpfs       152624       0    152624   0% /run/user/0

-t , --type=TYPE

Show space usage for a specific filesystem

[root@centos7 ~]$df -t tmpfs
Filesystem     1K-blocks  Used Available Use% Mounted on
tmpfs             763104     0    763104   0% /dev/shm
tmpfs             763104 10516    752588   2% /run
tmpfs             763104     0    763104   0% /sys/fs/cgroup
tmpfs             152624    12    152612   1% /run/user/42
tmpfs             152624     0    152624   0% /run/user/0
[root@centos7 ~]$df -t xfs
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/sda2      104806400 5169704  99636696   5% /
/dev/sda3       52403200   32996  52370204   1% /data
/dev/sda1        1038336  171704    866632  17% /boot

-x, --exclude-type

Show unspecified filesystems

[root@centos7 ~]$df -x tmpfs          # 显示除了tmpfs以外的文件系统
Filesystem     1K-blocks    Used Available Use% Mounted on
devtmpfs          747304       0    747304   0% /dev
/dev/sda2      104806400 5169704  99636696   5% /
/dev/sda3       52403200   32996  52370204   1% /data
/dev/sda1        1038336  171704    866632  17% /boot

[free] Show system memory usage

  • By default, it displays the total amount of system free memory and used memory, the usage of swap space and the cache usage of the kernel. The information displayed by this command is obtained by parsing the /proc/meminfo file. usage:
> free [options]
[root@centos7 ~]$free
              total        used        free      shared  buff/cache   available
Mem:        1526208      509240      640412       12744      376556      841456
Swap:       3145724           0     3145724
  • options:

-b, --bytes

Displayed in units of one byte.

-k, --kilo

In kilobytes, selected by default.

-m, --mega

display in megabytes

-g, --giga

Displayed in gigabytes.

--tera in Tera.

--peta in P units.

-h, --human

Displayed in properly sized units for human reading

-w, --wide

Use wide format to display buffer and cache separately, similar to centos6

[root@centos7 ~]$free -w
              total        used        free      shared     buffers       cache   available
Mem:        1526208      763656      116976       19932          40      645536      576160
Swap:       3145724         264     3145460

[hash]

  • Every time an external command is executed, the full path of a command will be recorded by hash by searching the folders in PATH. If a command is run multiple times, it will hit the command access information in the hash cache. At this time, bash will no longer search for the folder in PATH and record it. If a command is run multiple times, it will hit the command access information in the hash cache, and bash will no longer searchP A T H in the folder and record. If a command is run multiple times, it will hit the command access information cached by ha s h . At this time, ba s h will no longer search the PATH, and can directly find and run the command.
> hash [-lr] [-p filename] [-dt] [name]

hash -r

-r Use this option to clear the hash table, in case bash still searches the path in the hash table and cannot find the command after moving some external commands.

hash -t

This option causes the names of the following commands to be printed before their full path names

[root@centos7 ~]$hash -t tr ls
tr      /usr/bin/tr
ls      /usr/bin/ls

hash -l

This option makes the printed format available for input purposes

[root@centos7 ~]$hash -l
builtin hash -p /usr/bin/tr 
builtin hash -p /usr/bin/ls 

[hostname] view and display hostname

hostname [new hostname]

This operation will be invalid after restarting the computer next time, editing the /etc/hostname file will take effect permanently

hostname -d

hostname -f

hostnaem -i

[root@centos7 /var/www/html]$hostname -f
centos7.magedu.steve
[root@centos7 /var/www/html]$hostname -i
fe80::43be:3721:e7cd:b3a3%ens33 192.168.142.136 192.168.122.1
[root@centos7 /var/www/html]$hostname -d
magedu.steve

[lscpu] Print information related to cpu architecture

lscpu [-a|-b|-c|-J] [-x] [-y] [-s directory] [-e[=list]|-p[=list]]

lscpu -h|-V

[lsblk] list block device related information

  • This command lists the block devices available in the current system through the file system information collected by sysfs. By default, this command prints all block devices (excluding RAM) in a tree structure.
  • usage:
       -a, --all
              包含空设备.  (By default they are skipped.)

       -b, --bytes
              制指定SIZE栏的单位.

       -D, --discard
              打印关于每个设备丢弃功能(修剪、取消映射)的信息.

       -d, --nodeps
              不打印隶属于该设备的设备信息.  For example, lsblk --nodeps /dev/sda prints information about the sda device only.
               \```
               [root@centos7 ~]$lsblk --nodeps /dev/sda
               NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
               sda    8:0    0  200G  0 disk 
               [root@centos7 ~]$lsblk /dev/sda         
               NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
               sda      8:0    0  200G  0 disk 
               ├─sda1   8:1    0    1G  0 part /boot
               ├─sda2   8:2    0  100G  0 part /
               ├─sda3   8:3    0   50G  0 part /data
               ├─sda4   8:4    0    1K  0 part 
               └─sda5   8:5    0    3G  0 part [SWAP]
               ```
       -f, --fs
              Output info about filesystems.  This option is equivalent to -o NAME,FSTYPE,LABEL,MOUNTPOINT.  The authoritative information about filesystems  and
              raids is provided by the blkid(8) command.

       -h, --help
              Print a help text and exit.

       -I, --include list
              Include devices specified by the comma-separated list of major device numbers.  The filter is applied to the top-level devices only.

       -i, --ascii
              Use ASCII characters for tree formatting.

       -l, --list
              Produce output in the form of a list.

       -m, --perms
              Output info about device owner, group and mode.  This option is equivalent to -o NAME,SIZE,OWNER,GROUP,MODE.

       -n, --noheadings
              Do not print a header line.

       -o, --output list
              Specify which output columns to print.  Use --help to get a list of all supported columns.

              The default list of columns may be extended if list is specified in the format +list (e.g. lsblk -o +UUID).

       -P, --pairs
              Produce output in the form of key="value" pairs.  All potentially unsafe characters are hex-escaped (\x<code>).

       -p, --paths
              Print full device paths.

       -r, --raw
              Produce  output  in  raw  format.  All potentially unsafe characters are hex-escaped (\x<code>) in the NAME, KNAME, LABEL, PARTLABEL and MOUNTPOINT
              columns.

       -S, --scsi
              Output info about SCSI devices only.  All partitions, slaves and holder devices are ignored.

       -s, --inverse
              Print dependencies in inverse order.

       -t, --topology
              Output info about block-device topology.  This option is equivalent to -o NAME,ALIGNMENT,MIN-IO,OPT-IO,PHY-SEC,LOG-SEC,ROTA,SCHED,RQ-SIZE,WSAME.
\```

```bash
[root@centos7 ~]$lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    0  200G  0 disk 
├─sda1   8:1    0    1G  0 part /boot
├─sda2   8:2    0  100G  0 part /
├─sda3   8:3    0   50G  0 part /data
├─sda4   8:4    0    1K  0 part 
└─sda5   8:5    0    3G  0 part [SWAP]
sdb      8:16   0  100G  0 disk 
sr0     11:0    1 10.3G  0 rom  /run/media/steve/CentOS 7 x86_64
[root@centos7 ~]$lsblk --fs
NAME   FSTYPE  LABEL           UUID                                 MOUNTPOINT
sda                                                                 
├─sda1 xfs                     64e5c295-18f6-4a06-815c-96ce9f316b69 /boot
├─sda2 xfs                     2f98e043-cee1-4eaf-97f8-7ecf3cfd7228 /
├─sda3 xfs                     cae2d8fc-15b1-4750-bf94-267b411c4178 /data
├─sda4                                                              
└─sda5 swap                    eb86e30f-4567-4869-b840-1b70f6562bf9 [SWAP]
sdb                                                                 
sr0    iso9660 CentOS 7 x86_64 2019-09-09-19-08-41-00               /run/media/steve/CentOS 7 x86_64
[root@centos7 ~]$lsblk -f
NAME   FSTYPE  LABEL           UUID                                 MOUNTPOINT
sda                                                                 
├─sda1 xfs                     64e5c295-18f6-4a06-815c-96ce9f316b69 /boot
├─sda2 xfs                     2f98e043-cee1-4eaf-97f8-7ecf3cfd7228 /
├─sda3 xfs                     cae2d8fc-15b1-4750-bf94-267b411c4178 /data
├─sda4                                                              
└─sda5 swap                    eb86e30f-4567-4869-b840-1b70f6562bf9 [SWAP]
sdb                                                                 
sr0    iso9660 CentOS 7 x86_64 2019-09-09-19-08-41-00               /run/media/steve/CentOS 7 x86_64
[root@centos7 ~]$lsblk -t
NAME   ALIGNMENT MIN-IO OPT-IO PHY-SEC LOG-SEC ROTA SCHED    RQ-SIZE   RA WSAME
sda            0    512      0     512     512    1 deadline     128 4096   32M
├─sda1         0    512      0     512     512    1 deadline     128 4096   32M
├─sda2         0    512      0     512     512    1 deadline     128 4096   32M
├─sda3         0    512      0     512     512    1 deadline     128 4096   32M
├─sda4         0    512      0     512     512    1 deadline     128 4096   32M
└─sda5         0    512      0     512     512    1 deadline     128 4096   32M
sdb            0    512      0     512     512    1 deadline     128 4096   32M
sr0            0   2048      0    2048    2048    1 deadline     128  128    0B
[root@centos7 ~]$lsblk -b
NAME   MAJ:MIN RM         SIZE RO TYPE MOUNTPOINT
sda      8:0    0 214748364800  0 disk 
├─sda1   8:1    0   1073741824  0 part /boot
├─sda2   8:2    0 107374182400  0 part /
├─sda3   8:3    0  53687091200  0 part /data
├─sda4   8:4    0         1024  0 part 
└─sda5   8:5    0   3221225472  0 part [SWAP]
sdb      8:16   0 107374182400  0 disk 
sr0     11:0    1  11026825216  0 rom  /run/media/steve/CentOS 7 x86_64
[root@centos7 ~]$lsblk -p /dev/sda
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
/dev/sda      8:0    0  200G  0 disk 
├─/dev/sda1   8:1    0    1G  0 part /boot
├─/dev/sda2   8:2    0  100G  0 part /
├─/dev/sda3   8:3    0   50G  0 part /data
├─/dev/sda4   8:4    0    1K  0 part 
└─/dev/sda5   8:5    0    3G  0 part [SWAP]
[root@centos7 ~]$lsblk -l /dev/sda
NAME MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda    8:0    0  200G  0 disk 
sda1   8:1    0    1G  0 part /boot
sda2   8:2    0  100G  0 part /
sda3   8:3    0   50G  0 part /data
sda4   8:4    0    1K  0 part 
sda5   8:5    0    3G  0 part [SWAP]

[mv] move or rename a file

  • usage:
       mv [OPTION]... [-T] SOURCE DEST
       mv [OPTION]... SOURCE... DIRECTORY
       mv [OPTION]... -t DIRECTORY SOURCE...
  • options:
       --backup[=CONTROL]
              备份已经存在的目标文件,默认备份文件名为'原文件~'

       -b     类似 --backup 但是不接受参数

       -f, --force
              覆盖文件时不提示

       -i, --interactive
              覆盖前提示

       -n, --no-clobber
              不要覆盖已经存在的文件

       注意注意注意:如果多个选项被指定,最后一个有效

       --strip-trailing-slashes
              remove any trailing slashes from each SOURCE argument

       -S, --suffix=SUFFIX
              替换默认的备份文件名后缀

       -t, --target-directory=DIRECTORY
              move all SOURCE arguments into DIRECTORY

       -T, --no-target-directory
              视目标为普通文件

       -u, --update
              只有当源文件新于目标文件或者目标文件不存在时才移动
              
       -v, --verbose
              显示详细信息

[nano] Simple character interface editor under linux

[runlevel] Display system run level

  • By default, the previous and current SysV system runlevels are displayed
[root@centos7 /data]$runlevel
N 5

After running runlevel above, N 5 is displayed, with a single space in the middle. N means that the previous system running level cannot be recognized, and 5 means that the current system is running and connected to 5, which is the level with a graphical interface.

/var/run/utmp
: runlevel reads the place where the utmp database of the two run levels is located.

[tty] print the filename of the terminal linked to standard input

-s, --silent, --quiet

doesn't print anything, just returns an exit status

[root@centos7 /data]$tty
/dev/pts/4
[root@centos7 /data]$tty -s
[root@centos7 /data]$echo $?  # 显示tty -s 的退出状态
0                             # 退出状态为0 表示成功执行

[type] Determine whether a name needs to be resolved into a command name

type -t name

The -t option indicates that the type identifies whether the input name is an alias, a built-in command, a shell keyword or an external command. If it is not, no information will be printed and the exit status will be non-zero.

[root@centos7 /data]$type -t ls
alias
[root@centos7 /data]$type -t ll
alias
[root@centos7 /data]$type -t cd
builtin
[root@centos7 /data]$type -t type
builtin
[root@centos7 /data]$type -t tr
file
[root@centos7 /data]$type -t /etc
[root@centos7 /data]$type -t /etc/fstab
[root@centos7 /data]$type -t if
keyword
[root@centos7 /data]$type -t esac
keyword
type standard input alias built-in commands shell keyword external command
type command return value alias builtin keyword file

[unalias] Remove an alias from the list of defined command aliases

> unalias [-a] [name ...]

ualias -a

This command will remove all defined command aliases

[whoami] print valid user IDs

  • By default, the user name associated with the effective user id of the current system is printed, which is equivalent to: id -un
[root@centos7 /var/www/html]$ whoami
root
[root@centos7 /var/www/html]$ who am i
root     pts/3        2019-09-21 13:53 (192.168.142.1)
[root@centos7 /var/www/html]$ who is 666
root     pts/3        2019-09-21 13:53 (192.168.142.1)

Guess you like

Origin blog.csdn.net/wang11876/article/details/132206832