扩展字符使用
[root@bind-s-74 ~]# echo {a..c}
a b c
[root@bind-s-74 ~]# echo {1..c}
{1..c}
[root@bind-s-74 ~]# echo {1..6}
1 2 3 4 5 6
[root@bind-s-74 ~]# cd /home/scripts/bash/
-bash: cd: /home/scripts/bash/: 没有那个文件或目录
[root@bind-s-74 ~]# cd ~
#查看自己的用户
[root@bind-s-74 ~]# echo $HOME
/root
#使用seq命令扩展
[root@bind-s-74 ~]# seq 3
1
2
3
[root@bind-s-74 ~]# seq4
-bash: seq4:未找到命令
[root@bind-s-74 ~]# seq 5
1
2
3
4
5
#使用echo输出时间
[root@bind-s-74 ~]# echo `date +%F`
2024-01-24
[root@bind-s-74 ~]# echo `date +R`
R
[root@bind-s-74 ~]# echo `date +%R`
15:00
#通配符的使用
[root@bind-s-74 ~]# ls -lhrt *
-rw-------. 1 root root 1.1K 1月 15 16:23 anaconda-ks.cfg
-rw-r--r--. 1 root root 2.3K 1月 15 16:35 chushihua.sh
-rw-r--r-- 1 root root 439M 1月 15 18:12 mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
-rw-r--r-- 1 root root 12M 1月 19 13:54 openrestry.tgz
-rw-r--r-- 1 root root 1.1M 1月 21 09:21 nginx-1.20.2.tar.gz
-rw-r--r-- 1 root root 15M 1月 21 16:33 php-7.2.18.tar.bz2
php-7.2.18:
总用量 4.1M
-rw-rw-r-- 1 root root 3.3K 4月 30 2019 UPGRADING.INTERNALS
-rw-rw-r-- 1 root root 15K 4月 30 2019 UPGRADING
drwxrwxr-x 3 root root 4.0K 4月 30 2019 TSRM
-rw-rw-r-- 1 root root 10 4月 30 2019 stamp-h.in
[root@bind-s-74 ~]# ll *
-rw-------. 1 root root 1042 1月 15 16:23 anaconda-ks.cfg
-rw-r--r--. 1 root root 2271 1月 15 16:35 chushihua.sh
-rw-r--r-- 1 root root 459678820 1月 15 18:12 mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
-rw-r--r-- 1 root root 1062124 1月 21 09:21 nginx-1.20.2.tar.gz
-rw-r--r-- 1 root root 11554993 1月 19 13:54 openrestry.tgz
-rw-r--r-- 1 root root 15075704 1月 21 16:33 php-7.2.18.tar.bz2
mysql-8.2.0-linux-glibc2.17-x86_64:
总用量 296
drwxr-xr-x 2 7161 31415 4096 10月 12 21:20 bin
drwxr-xr-x 2 7161 31415 38 10月 12 21:20 docs
drwxr-xr-x 3 7161 31415 4096 10月 12 21:20 include
drwxr-xr-x 6 7161 31415 4096 10月 12 21:20 lib
-rw-r--r-- 1 7161 31415 279351 10月 12 19:40 LICENSE
drwxr-xr-x 4 7161 31415 30 10月 12 21:20 man
-rw-r--r-- 1 7161 31415 666 10月 12 19:40 README
drwxr-xr-x 28 7161 31415 4096 10月 12 21:20 share
drwxr-xr-x 2 7161 31415 77 10月 12 21:20 support-files
nginx-1.20.2:
总用量 796
drwxr-xr-x 6 1001 1001 4096 1月 21 09:22 auto
-rw-r--r-- 1 1001 1001 312251 11月 16 2021 CHANGES
-rw-r--r-- 1 1001 1001 476577 11月 16 2021 CHANGES.ru
drwxr-xr-x 2 1001 1001 168 1月 21 09:22 conf
-rwxr-xr-x 1 1001 1001 2590 11月 16 2021 configure
drwxr-xr-x 4 1001 1001 72 1月 21 09:22 contrib
drwxr-xr-x 2 1001 1001 40 1月 21 09:22 html
-rw-r--r-- 1 1001 1001 1397 11月 16 2021 LICENSE
-rw-r--r-- 1 root root 438 1月 21 15:58 Makefile
drwxr-xr-x 2 1001 1001 21 1月 21 09:22 man
drwxr-xr-x 3 root root 125 1月 21 15:58 objs
-rw-r--r-- 1 1001 1001 49 11月 16 2021 README
drwxr-xr-x 9 1001 1001 91 1月 21 09:22 src
php-7.2.18:
总用量 4108
-rw-rw-r-- 1 root root 86561 4月 30 2019 acinclude.m4
-rw-r--r-- 1 root root 316938 4月 30 2019 aclocal.m4
drwxrwxr-x 2 root root 82 4月 30 2019 appveyor
drwxrwxr-x 2 root root 4096 4月 30 2019 build
-rwxrwxr-x 1 root root 780 4月 30 2019 buildconf
-rw-rw-r-- 1 root root 335 4月 30 2019 buildconf.bat
-rw-rw-r-- 1 root root 11964 4月 30 2019 CODING_STANDARDS
-rw-rw-r-- 1 root root 42938 4月 30 2019 config.guess
-rw-rw-r-- 1 root root 35967 4月 30 2019 config.sub
-rwxr-xr-x 1 root root 2652243 4月 30 2019 configure
-rw-rw-r-- 1 root root 46869 4月 30 2019 configure.ac
-rw-rw-r-- 1 root root 3428 4月 30 2019 CONTRIBUTING.md
-rw-rw-r-- 1 root root 91 4月 30 2019 CREDITS
drwxrwxr-x 76 root root 4096 4月 30 2019 ext
-rw-rw-r-- 1 root root 21106 4月 30 2019 EXTENSIONS
-rw-rw-r-- 1 root root 136 4月 30 2019 footer
-rw-r--r-- 1 root root 1800 4月 30 2019 generated_lists
-rwxrwxr-x 1 root root 580 4月 30 2019 genfiles
-rw-rw-r-- 1 root root 1143 4月 30 2019 header
-rw-rw-r-- 1 root root 87836 4月 30 2019 INSTALL
-rw-r--r-- 1 root root 0 4月 30 2019 install-sh
-rw-rw-r-- 1 root root 3204 4月 30 2019 LICENSE
-rw-rw-r-- 1 root root 199728 4月 30 2019 ltmain.sh
drwxrwxr-x 3 root root 4096 4月 30 2019 main
-rwxrwxr-x 1 root root 4132 4月 30 2019 makedist
-rw-rw-r-- 1 root root 1087 4月 30 2019 Makefile.frag
-rw-rw-r-- 1 root root 2483 4月 30 2019 Makefile.gcov
-rw-rw-r-- 1 root root 7156 4月 30 2019 Makefile.global
-rw-r--r-- 1 root root 0 4月 30 2019 missing
-rw-r--r-- 1 root root 0 4月 30 2019 mkinstalldirs
-rw-rw-r-- 1 root root 107350 4月 30 2019 NEWS
drwxrwxr-x 2 root root 100 4月 30 2019 pear
-rw-rw-r-- 1 root root 1489 4月 30 2019 php7.spec.in
-rw-rw-r-- 1 root root 2523 4月 30 2019 php.gif
-rw-rw-r-- 1 root root 71232 4月 30 2019 php.ini-development
-rw-rw-r-- 1 root root 71504 4月 30 2019 php.ini-production
-rw-rw-r-- 1 root root 6999 4月 30 2019 README.EXT_SKEL
-rw-rw-r-- 1 root root 5113 4月 30 2019 README.GIT-RULES
-rw-rw-r-- 1 root root 5416 4月 30 2019 README.input_filter
-rw-rw-r-- 1 root root 3426 4月 30 2019 README.MAILINGLIST_RULES
-rw-rw-r-- 1 root root 1607 4月 30 2019 README.md
-rw-rw-r-- 1 root root 5234 4月 30 2019 README.NEW-OUTPUT-API
-rw-rw-r-- 1 root root 7519 4月 30 2019 README.PARAMETER_PARSING_API
-rw-rw-r-- 1 root root 19716 4月 30 2019 README.REDIST.BINS
-rw-rw-r-- 1 root root 14381 4月 30 2019 README.RELEASE_PROCESS
-rw-rw-r-- 1 root root 5074 4月 30 2019 README.SELF-CONTAINED-EXTENSIONS
-rw-rw-r-- 1 root root 15316 4月 30 2019 README.STREAMS
-rw-rw-r-- 1 root root 8125 4月 30 2019 README.SUBMITTING_PATCH
-rw-rw-r-- 1 root root 6687 4月 30 2019 README.TESTING
-rw-rw-r-- 1 root root 4944 4月 30 2019 README.TESTING2
-rw-rw-r-- 1 root root 4261 4月 30 2019 README.UNIX-BUILD-SYSTEM
-rw-rw-r-- 1 root root 114 4月 30 2019 README.WIN32-BUILD-SYSTEM
-rwxrwxr-x 1 root root 85730 4月 30 2019 run-tests.php
drwxrwxr-x 10 root root 118 4月 30 2019 sapi
drwxrwxr-x 4 root root 105 4月 30 2019 scripts
-rwxrwxr-x 1 root root 2099 4月 30 2019 server-tests-config.php
-rwxrwxr-x 1 root root 52494 4月 30 2019 server-tests.php
-rwxrwxr-x 1 root root 108 4月 30 2019 snapshot
-rw-rw-r-- 1 root root 10 4月 30 2019 stamp-h.in
drwxrwxr-x 10 root root 142 4月 30 2019 tests
drwxrwxr-x 3 root root 35 4月 30 2019 travis
drwxrwxr-x 3 root root 4096 4月 30 2019 TSRM
-rw-rw-r-- 1 root root 14855 4月 30 2019 UPGRADING
-rw-rw-r-- 1 root root 3290 4月 30 2019 UPGRADING.INTERNALS
-rwxrwxr-x 1 root root 159 4月 30 2019 vcsclean
drwxrwxr-x 3 root root 4096 4月 30 2019 win32
drwxrwxr-x 3 root root 8192 4月 30 2019 Zend
source-lnmp:
总用量 441784
drwxr-xr-x 9 root root 129 1月 21 16:08 mysql-8.2.0-linux-glibc2.17-x86_64
-rw-r--r-- 1 root root 452383016 1月 21 16:00 mysql-8.2.0-linux-glibc2.17-x86_64.tar.xz
usr:
总用量 0
drwxr-xr-x 3 root root 28 1月 19 13:55 local
[root@bind-s-74 ~]# ll
总用量 475972
-rw-------. 1 root root 1042 1月 15 16:23 anaconda-ks.cfg
-rw-r--r--. 1 root root 2271 1月 15 16:35 chushihua.sh
-rw-r--r-- 1 root root 459678820 1月 15 18:12 mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
drwxr-xr-x 9 root root 129 1月 21 16:06 mysql-8.2.0-linux-glibc2.17-x86_64
drwxr-xr-x 9 1001 1001 186 1月 21 09:27 nginx-1.20.2
-rw-r--r-- 1 root root 1062124 1月 21 09:21 nginx-1.20.2.tar.gz
-rw-r--r-- 1 root root 11554993 1月 19 13:54 openrestry.tgz
drwxrwxr-x 14 root root 4096 4月 30 2019 php-7.2.18
-rw-r--r-- 1 root root 15075704 1月 21 16:33 php-7.2.18.tar.bz2
drwxr-xr-x 3 root root 97 1月 21 16:08 source-lnmp
drwxr-xr-x 3 root root 19 1月 19 13:55 usr
[root@bind-s-74 ~]# echo abc
abc
[root@bind-s-74 ~]# ll
总用量 475972
-rw-------. 1 root root 1042 1月 15 16:23 anaconda-ks.cfg
-rw-r--r--. 1 root root 2271 1月 15 16:35 chushihua.sh
-rw-r--r-- 1 root root 459678820 1月 15 18:12 mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
drwxr-xr-x 9 root root 129 1月 21 16:06 mysql-8.2.0-linux-glibc2.17-x86_64
drwxr-xr-x 9 1001 1001 186 1月 21 09:27 nginx-1.20.2
-rw-r--r-- 1 root root 1062124 1月 21 09:21 nginx-1.20.2.tar.gz
-rw-r--r-- 1 root root 11554993 1月 19 13:54 openrestry.tgz
drwxrwxr-x 14 root root 4096 4月 30 2019 php-7.2.18
-rw-r--r-- 1 root root 15075704 1月 21 16:33 php-7.2.18.tar.bz2
drwxr-xr-x 3 root root 97 1月 21 16:08 source-lnmp
drwxr-xr-x 3 root root 19 1月 19 13:55 usr
#使用touch 连续创建1-2命名的文件
[root@bind-s-74 ~]# touch file-{1..2}.txt
#使用*查看所有.txt结尾的文件
[root@bind-s-74 ~]# ls *.txt
file-1.txt file-2.txt
使用中括号查看1-2.txt结尾的文件
[root@bind-s-74 ~]# ls -lhrt *[12].txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-2.txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-1.txt
[root@bind-s-74 ~]# ls -lhrt *[1..2].txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-2.txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-1.txt
查看所有新建的文件带时间戳
[root@bind-s-74 ~]# ls -lhrt
总用量 465M
drwxrwxr-x 14 root root 4.0K 4月 30 2019 php-7.2.18
-rw-------. 1 root root 1.1K 1月 15 16:23 anaconda-ks.cfg
-rw-r--r--. 1 root root 2.3K 1月 15 16:35 chushihua.sh
-rw-r--r-- 1 root root 439M 1月 15 18:12 mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
-rw-r--r-- 1 root root 12M 1月 19 13:54 openrestry.tgz
drwxr-xr-x 3 root root 19 1月 19 13:55 usr
-rw-r--r-- 1 root root 1.1M 1月 21 09:21 nginx-1.20.2.tar.gz
drwxr-xr-x 9 1001 1001 186 1月 21 09:27 nginx-1.20.2
drwxr-xr-x 9 root root 129 1月 21 16:06 mysql-8.2.0-linux-glibc2.17-x86_64
drwxr-xr-x 3 root root 97 1月 21 16:08 source-lnmp
-rw-r--r-- 1 root root 15M 1月 21 16:33 php-7.2.18.tar.bz2
-rw-r--r-- 1 root root 0 1月 24 15:01 file-2.txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-1.txt
#查看目录下的隐藏文件
[root@bind-s-74 ~]# ls -la
总用量 476036
dr-xr-x---. 9 root root 4096 1月 24 15:01 .
dr-xr-xr-x. 20 root root 278 1月 18 19:01 ..
-rw-------. 1 root root 1042 1月 15 16:23 anaconda-ks.cfg
-rw-------. 1 root root 19291 1月 23 20:12 .bash_history
-rw-r--r--. 1 root root 18 8月 10 2021 .bash_logout
-rw-r--r--. 1 root root 141 8月 10 2021 .bash_profile
-rw-r--r--. 1 root root 429 8月 10 2021 .bashrc
-rw-r--r--. 1 root root 2271 1月 15 16:35 chushihua.sh
drwx------ 3 root root 20 1月 18 18:51 .config
-rw-r--r--. 1 root root 100 8月 10 2021 .cshrc
-rw-r--r-- 1 root root 0 1月 24 15:01 file-1.txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-2.txt
-rw------- 1 root root 20 1月 23 11:49 .lesshst
-rw-r--r-- 1 root root 459678820 1月 15 18:12 mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
drwxr-xr-x 9 root root 129 1月 21 16:06 mysql-8.2.0-linux-glibc2.17-x86_64
-rw------- 1 root root 1992 1月 18 10:26 .mysql_history
drwxr-xr-x 9 1001 1001 186 1月 21 09:27 nginx-1.20.2
-rw-r--r-- 1 root root 1062124 1月 21 09:21 nginx-1.20.2.tar.gz
-rw-r--r-- 1 root root 11554993 1月 19 13:54 openrestry.tgz
drwxrwxr-x 14 root root 4096 4月 30 2019 php-7.2.18
-rw-r--r-- 1 root root 15075704 1月 21 16:33 php-7.2.18.tar.bz2
drwxr-xr-x 3 root root 97 1月 21 16:08 source-lnmp
drwx------. 2 root root 48 1月 21 09:47 .ssh
-rw-r--r--. 1 root root 129 8月 10 2021 .tcshrc
drwxr-xr-x 3 root root 19 1月 19 13:55 usr
-rw------- 1 root root 11764 1月 23 19:13 .viminfo
[root@bind-s-74 ~]# ls -lhrt -a
总用量 465M
drwxrwxr-x 14 root root 4.0K 4月 30 2019 php-7.2.18
-rw-r--r--. 1 root root 129 8月 10 2021 .tcshrc
-rw-r--r--. 1 root root 100 8月 10 2021 .cshrc
-rw-r--r--. 1 root root 429 8月 10 2021 .bashrc
-rw-r--r--. 1 root root 141 8月 10 2021 .bash_profile
-rw-r--r--. 1 root root 18 8月 10 2021 .bash_logout
-rw-------. 1 root root 1.1K 1月 15 16:23 anaconda-ks.cfg
-rw-r--r--. 1 root root 2.3K 1月 15 16:35 chushihua.sh
-rw-r--r-- 1 root root 439M 1月 15 18:12 mysql-8.0.35-linux-glibc2.28-x86_64.tar.xz
-rw------- 1 root root 2.0K 1月 18 10:26 .mysql_history
drwx------ 3 root root 20 1月 18 18:51 .config
dr-xr-xr-x. 20 root root 278 1月 18 19:01 ..
-rw-r--r-- 1 root root 12M 1月 19 13:54 openrestry.tgz
drwxr-xr-x 3 root root 19 1月 19 13:55 usr
-rw-r--r-- 1 root root 1.1M 1月 21 09:21 nginx-1.20.2.tar.gz
drwxr-xr-x 9 1001 1001 186 1月 21 09:27 nginx-1.20.2
drwx------. 2 root root 48 1月 21 09:47 .ssh
drwxr-xr-x 9 root root 129 1月 21 16:06 mysql-8.2.0-linux-glibc2.17-x86_64
drwxr-xr-x 3 root root 97 1月 21 16:08 source-lnmp
-rw-r--r-- 1 root root 15M 1月 21 16:33 php-7.2.18.tar.bz2
-rw------- 1 root root 20 1月 23 11:49 .lesshst
-rw------- 1 root root 12K 1月 23 19:13 .viminfo
-rw-------. 1 root root 19K 1月 23 20:12 .bash_history
-rw-r--r-- 1 root root 0 1月 24 15:01 file-2.txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-1.txt
dr-xr-x---. 9 root root 4.0K 1月 24 15:01 .
[root@bind-s-74 ~]# ls -a -lhrt *[1..2].txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-2.txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-1.txt
[root@bind-s-74 ~]#
[root@bind-s-74 ~]# ls -a -lhrt *[1..2].txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-2.txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-1.txt
[root@bind-s-74 ~]# ls -lhrt [0-9].txt
ls: 无法访问 '[0-9].txt': 没有那个文件或目录
[root@bind-s-74 ~]# ls -lhrt *[0-9].txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-2.txt
-rw-r--r-- 1 root root 0 1月 24 15:01 file-1.txt
[root@bind-s-74 ~]# ls -lhrt *[0..9].txt
ls: 无法访问 '*[0..9].txt': 没有那个文件或目录
[root@bind-s-74 ~]# expr `1 + 5`
-bash: 1:未找到命令
expr: 缺少操作数
请尝试执行 "expr --help" 来获取更多信息。
[root@bind-s-74 ~]# `expr 1 + 5`
-bash: 6:未找到命令
算数符的应用
[root@bind-s-74 ~]# echo `expr 1 + 5`
6
[root@bind-s-74 ~]# a=`expr 1 - 5`
[root@bind-s-74 ~]# echo $a
-4
[root@bind-s-74 ~]# a=`expr 1 + 5`
[root@bind-s-74 ~]# echo `expr 1 + 5`
6
[root@bind-s-74 ~]# echo `expr 1 \* 5`
5
[root@bind-s-74 ~]# echo `expr 3 \* 5`
15
[root@bind-s-74 ~]# echo $e
[root@bind-s-74 ~]# e=`expr 5 `
[root@bind-s-74 ~]# e=`expr 5 / 2`
[root@bind-s-74 ~]# echo $((1 + 2))
3
[root@bind-s-74 ~]# echo $((2 * 2))
4
使用grep过滤passwd中的文件
[root@bind-s-74 ~]# grep [[:lower:]] /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:65534:65534:Kernel Overflow User:/:/sbin/nologin
systemd-coredump:x:999:997:systemd Core Dumper:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
tss:x:59:59:Account used for TPM access:/:/sbin/nologin
sssd:x:998:996:User for sssd:/:/sbin/nologin
chrony:x:997:995:chrony system user:/var/lib/chrony:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/usr/share/empty.sshd:/usr/sbi/nologin
systemd-oom:x:993:993:systemd Userspace OOM Killer:/:/usr/sbin/noloin
mysql:x:1000:1000::/home/mysql:/sbin/nologin
named:x:25:25:Named:/var/named:/sbin/nologin
搜索所有别名
[root@bind-s-74 ~]# alias |grep grep
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias xzegrep='xzegrep --color=auto'
alias xzfgrep='xzfgrep --color=auto'
alias xzgrep='xzgrep --color=auto'
alias zegrep='zegrep --color=auto'
alias zfgrep='zfgrep --color=auto'
alias zgrep='zgrep --color=auto'
[[:lower:]]匹配任意小写字母 a-z
[root@bind-s-74 ~]# grep [[:lower:]] /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:65534:65534:Kernel Overflow User:/:/sbin/nologin
systemd-coredump:x:999:997:systemd Core Dumper:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
tss:x:59:59:Account used for TPM access:/:/sbin/nologin
sssd:x:998:996:User for sssd:/:/sbin/nologin
chrony:x:997:995:chrony system user:/var/lib/chrony:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/usr/share/empty.sshd:/usr/sbi/nologin
systemd-oom:x:993:993:systemd Userspace OOM Killer:/:/usr/sbin/noloin
mysql:x:1000:1000::/home/mysql:/sbin/nologin
named:x:25:25:Named:/var/named:/sbin/nologin
[[:digit:]]匹配任意数字 0-9
[root@bind-s-74 ~]# grep [[:digit:]] /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:65534:65534:Kernel Overflow User:/:/sbin/nologin
systemd-coredump:x:999:997:systemd Core Dumper:/:/sbin/nologin
dbus:x:81:81:System message bus:/:/sbin/nologin
tss:x:59:59:Account used for TPM access:/:/sbin/nologin
sssd:x:998:996:User for sssd:/:/sbin/nologin
chrony:x:997:995:chrony system user:/var/lib/chrony:/sbin/nologin
sshd:x:74:74:Privilege-separated SSH:/usr/share/empty.sshd:/usr/sbin/nologin
systemd-oom:x:993:993:systemd Userspace OOM Killer:/:/usr/sbin/nologin
mysql:x:1000:1000::/home/mysql:/sbin/nologin
named:x:25:25:Named:/var/named:/sbin/nologin
查看别名
[root@bind-s-74 ~]# alias |grep grep
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias xzegrep='xzegrep --color=auto'
alias xzfgrep='xzfgrep --color=auto'
alias xzgrep='xzgrep --color=auto'
alias zegrep='zegrep --color=auto'
alias zfgrep='zfgrep --color=auto'
alias zgrep='zgrep --color=auto'
[root@bind-s-74 ~]# head /etc/passwd |grep [[:lower:]]
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
[root@bind-s-74 ~]# head /etc/passwd |grep [[:digit:]]
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin
[root@bind-s-74 ~]#