Linux系统之diff命令的基本使用

举报
江湖有缘 发表于 2023/03/11 19:32:55 2023/03/11
【摘要】 Linux系统之diff命令的基本使用

一、diff命令介绍

diff工具的主要作用是比较两个文件的不同。该命令的功能为逐行比较两个文本文件,列出其不同之处。它对给出的文件进行系统的检查, 并显示出两个文件中所有不同的行,不要求事先对文件进行排序。

二、本次实践环境介绍

1.操作系统版本

本次使用的操作系统版本为centos7.6

[root@jeven ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core) 

2.操作系统内核版本

操作系统内核版本为3.10.0-957.el7.x86_64

[root@jeven ~]# cat /etc/centos-release
CentOS Linux release 7.6.1810 (Core) 
[root@jeven ~]# uname -r 
3.10.0-957.el7.x86_64

三、diff命令的安装

1.检查yum仓库状态

检查yum仓库状态

[root@jeven ~]# yum repolist all |grep enable 
!base/7/x86_64                       CentOS-7 - Base - mirrors.a enabled: 10,072
!docker-ce-stable/7/x86_64           Docker CE Stable - x86_64   enabled:    210
!elrepo                              ELRepo.org Community Enterp enabled:    155
!epel/x86_64                         Extra Packages for Enterpri enabled: 13,768
!extras/7/x86_64                     CentOS-7 - Extras - mirrors enabled:    515
!updates/7/x86_64                    CentOS-7 - Updates - mirror enabled:  4,839



2.检查diff工具是否安装

centos7默认已安装diff相关包,如未安装,可以直接yum安装即可。

[root@jeven ~]# yum list installed |grep diffutils
diffutils.x86_64                        3.3-4.el7                      @anaconda

3.安装diff

使用yum安装diff工具

[root@jeven ~]# yum -y install diffutils-3.3-5.el7.x86_64 
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * elrepo: mirrors.tuna.tsinghua.edu.cn
base                                                                                                                    | 3.6 kB  00:00:00     
docker-ce-stable                                                                                                        | 3.5 kB  00:00:00     
elrepo                                                                                                                  | 3.0 kB  00:00:00     
epel                                                                                                                    | 4.7 kB  00:00:00     
extras                                                                                                                  | 2.9 kB  00:00:00     
updates                                                                                                                 | 2.9 kB  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package diffutils.x86_64 0:3.3-4.el7 will be updated
---> Package diffutils.x86_64 0:3.3-5.el7 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===============================================================================================================================================
 Package                             Arch                             Version                             Repository                      Size
===============================================================================================================================================
Updating:
 diffutils                           x86_64                           3.3-5.el7                           base                           322 k

Transaction Summary
===============================================================================================================================================
Upgrade  1 Package

Total size: 322 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : diffutils-3.3-5.el7.x86_64                                                                                                  1/2 
  Cleanup    : diffutils-3.3-4.el7.x86_64                                                                                                  2/2 
  Verifying  : diffutils-3.3-5.el7.x86_64                                                                                                  1/2 
  Verifying  : diffutils-3.3-4.el7.x86_64                                                                                                  2/2 

Updated:
  diffutils.x86_64 0:3.3-5.el7                                                                                                                 

Complete!

四、diff的使用帮助

1.Linux中的help帮助

在linux中的–help输出


[root@jeven ~]# diff --help
Usage: diff [OPTION]... FILES
Compare FILES line by line.

Mandatory arguments to long options are mandatory for short options too.
      --normal                  output a normal diff (the default)
  -q, --brief                   report only when files differ
  -s, --report-identical-files  report when two files are the same
  -c, -C NUM, --context[=NUM]   output NUM (default 3) lines of copied context
  -u, -U NUM, --unified[=NUM]   output NUM (default 3) lines of unified context
  -e, --ed                      output an ed script
  -n, --rcs                     output an RCS format diff
  -y, --side-by-side            output in two columns
  -W, --width=NUM               output at most NUM (default 130) print columns
      --left-column             output only the left column of common lines
      --suppress-common-lines   do not output common lines

  -p, --show-c-function         show which C function each change is in
  -F, --show-function-line=RE   show the most recent line matching RE
      --label LABEL             use LABEL instead of file name
                                  (can be repeated)

  -t, --expand-tabs             expand tabs to spaces in output
  -T, --initial-tab             make tabs line up by prepending a tab
      --tabsize=NUM             tab stops every NUM (default 8) print columns
      --suppress-blank-empty    suppress space or tab before empty output lines
  -l, --paginate                pass output through 'pr' to paginate it

  -r, --recursive                 recursively compare any subdirectories found
      --no-dereference            don't follow symbolic links
  -N, --new-file                  treat absent files as empty
      --unidirectional-new-file   treat absent first files as empty
      --ignore-file-name-case     ignore case when comparing file names
      --no-ignore-file-name-case  consider case when comparing file names
  -x, --exclude=PAT               exclude files that match PAT
  -X, --exclude-from=FILE         exclude files that match any pattern in FILE
  -S, --starting-file=FILE        start with FILE when comparing directories
      --from-file=FILE1           compare FILE1 to all operands;
                                    FILE1 can be a directory
      --to-file=FILE2             compare all operands to FILE2;
                                    FILE2 can be a directory

  -i, --ignore-case               ignore case differences in file contents
  -E, --ignore-tab-expansion      ignore changes due to tab expansion
  -Z, --ignore-trailing-space     ignore white space at line end
  -b, --ignore-space-change       ignore changes in the amount of white space
  -w, --ignore-all-space          ignore all white space
  -B, --ignore-blank-lines        ignore changes where lines are all blank
  -I, --ignore-matching-lines=RE  ignore changes where all lines match RE

  -a, --text                      treat all files as text
      --strip-trailing-cr         strip trailing carriage return on input

  -D, --ifdef=NAME                output merged file with '#ifdef NAME' diffs
      --GTYPE-group-format=GFMT   format GTYPE input groups with GFMT
      --line-format=LFMT          format all input lines with LFMT
      --LTYPE-line-format=LFMT    format LTYPE input lines with LFMT
    These format options provide fine-grained control over the output
      of diff, generalizing -D/--ifdef.
    LTYPE is 'old', 'new', or 'unchanged'.  GTYPE is LTYPE or 'changed'.
    GFMT (only) may contain:
      %<  lines from FILE1
      %>  lines from FILE2
      %=  lines common to FILE1 and FILE2
      %[-][WIDTH][.[PREC]]{doxX}LETTER  printf-style spec for LETTER
        LETTERs are as follows for new group, lower case for old group:
          F  first line number
          L  last line number
          N  number of lines = L-F+1
          E  F-1
          M  L+1
      %(A=B?T:E)  if A equals B then T else E
    LFMT (only) may contain:
      %L  contents of line
      %l  contents of line, excluding any trailing newline
      %[-][WIDTH][.[PREC]]{doxX}n  printf-style spec for input line number
    Both GFMT and LFMT may contain:
      %%  %
      %c'C'  the single character C
      %c'\OOO'  the character with octal code OOO
      C    the character C (other characters represent themselves)

  -d, --minimal            try hard to find a smaller set of changes
      --horizon-lines=NUM  keep NUM lines of the common prefix and suffix
      --speed-large-files  assume large files and many scattered small changes

      --help               display this help and exit
  -v, --version            output version information and exit

FILES are 'FILE1 FILE2' or 'DIR1 DIR2' or 'DIR FILE...' or 'FILE... DIR'.
If --from-file or --to-file is given, there are no restrictions on FILE(s).
If a FILE is '-', read standard input.
Exit status is 0 if inputs are the same, 1 if different, 2 if trouble.

Report bugs to: bug-diffutils@gnu.org
GNU diffutils home page: <http://www.gnu.org/software/diffutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>


2.diff的使用说明

-<行数>:指定要显示多少行的文本。此参数必须与-c或-u参数一并使用;
-a或——text:diff预设只会逐行比较文本文件;
-b或–ignore-space-change:不检查空格字符的不同;
-B或–ignore-blank-lines:不检查空白行;
-c:显示全部内容,并标出不同之处;
-C<行数>或–context<行数>:与执行“-c-<行数>”指令相同;
-d或——minimal:使用不同的演算法,以小的单位来做比较;
-D<巨集名称>或ifdef<巨集名称>:此参数的输出格式可用于前置处理器巨集;
-e或——ed:此参数的输出格式可用于ed的script文件;
-f或-forward-ed:输出的格式类似ed的script文件,但按照原来文件的顺序来显示不同处;
-H或–speed-large-files:比较大文件时,可加快速度;
-l<字符或字符串>或–ignore-matching-lines<字符或字符串>:若两个文件在某几行有所不同,而之际航同时都包含了选项中指定的字符或字符串,则不显示这两个文件的差异;
-i或–ignore-case:不检查大小写的不同;
-l或——paginate:将结果交由pr程序来分页;
-n或——rcs:将比较结果以RCS的格式来显示;
-N或–new-file:在比较目录时,若文件A仅出现在某个目录中,预设会显示:Only in目录,文件A 若使用-N参数,则diff会将文件A 与一个空白的文件比较;
-p:若比较的文件为C语言的程序码文件时,显示差异所在的函数名称;
-P或–unidirectional-new-file:与-N类似,但只有当第二个目录包含了第一个目录所没有的文件时,才会将这个文件与空白的文件做比较;
-q或–brief:仅显示有无差异,不显示详细的信息;
-r或——recursive:比较子目录中的文件;
-s或–report-identical-files:若没有发现任何差异,仍然显示信息;
-S<文件>或–starting-file<文件>:在比较目录时,从指定的文件开始比较;
-t或–expand-tabs:在输出时,将tab字符展开;
-T或–initial-tab:在每行前面加上tab字符以便对齐;
-u,-U<列数>或–unified=<列数>:以合并的方式来显示文件内容的不同;
-v或——version:显示版本信息;
-w或–ignore-all-space:忽略全部的空格字符;
-W<宽度>或–width<宽度>:在使用-y参数时,指定栏宽;
-x<文件名或目录>或–exclude<文件名或目录>:不比较选项中所指定的文件或目录;
-X<文件>或–exclude-from<文件>;您可以将文件或目录类型存成文本文件,然后在=<文件>中指定此文本文件;
-y或–side-by-side:以并列的方式显示文件的异同之处;
–help:显示帮助;
–left-column:在使用-y参数时,若两个文件某一行内容相同,则仅在左侧的栏位显示该行内容;
–suppress-common-lines:在使用-y参数时,仅显示不同之处。

五、diff的基本使用

1.直接比较文件的区别

直接diff比较两个文件的区别,直接显示两个文件不同处的行及行号。

a - add   增加的内容
c - change  改变的内容
d - delete   删除的内容

[root@jeven tmp]# diff passwd passwd01 
18c18
< colord:x:997:994:User for colord:/var/lib/colord:/sbin/nologin
---
> coloa1rd:x:997:994:User for colord:/var/lib/colord:/sbin/nologin
28c28
< unbound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin
---
> un1abound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin
43c43
< tcpdump:x:72:72::/:/sbin/nologin
---
> 1atcpdump:x:72:72::/:/sbin/nologin


2.以上下文 (context) 模式比较差异

会在不同的位置,以上下文的模式来展现两个文件的不同

[root@jeven tmp]# diff -c passwd passwd01 
*** passwd	2023-03-11 18:33:21.672772433 +0800
--- passwd01	2023-03-11 18:33:39.395771582 +0800
***************
*** 15,21 ****
  dbus:x:81:81:System message bus:/:/sbin/nologin
  polkitd:x:999:998:User for polkitd:/:/sbin/nologin
  libstoragemgmt:x:998:995:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin
! colord:x:997:994:User for colord:/var/lib/colord:/sbin/nologin
  rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
  gluster:x:996:993:GlusterFS daemons:/run/gluster:/sbin/nologin
  saslauth:x:995:76:Saslauthd user:/run/saslauthd:/sbin/nologin
--- 15,21 ----
  dbus:x:81:81:System message bus:/:/sbin/nologin
  polkitd:x:999:998:User for polkitd:/:/sbin/nologin
  libstoragemgmt:x:998:995:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin
! coloa1rd:x:997:994:User for colord:/var/lib/colord:/sbin/nologin
  rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
  gluster:x:996:993:GlusterFS daemons:/run/gluster:/sbin/nologin
  saslauth:x:995:76:Saslauthd user:/run/saslauthd:/sbin/nologin
***************
*** 25,31 ****
  radvd:x:75:75:radvd user:/:/sbin/nologin
  rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
  nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
! unbound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin
  chrony:x:993:988::/var/lib/chrony:/sbin/nologin
  qemu:x:107:107:qemu user:/:/sbin/nologin
  tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
--- 25,31 ----
  radvd:x:75:75:radvd user:/:/sbin/nologin
  rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
  nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
! un1abound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin
  chrony:x:993:988::/var/lib/chrony:/sbin/nologin
  qemu:x:107:107:qemu user:/:/sbin/nologin
  tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
***************
*** 40,46 ****
  sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
  avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
  postfix:x:89:89::/var/spool/postfix:/sbin/nologin
! tcpdump:x:72:72::/:/sbin/nologin
  admin:x:1000:1000:admin:/home/admin:/bin/bash
  mysql:x:1001:1001::/home/mysql:/sbin/nologin
  redis:x:987:980:Redis Database Server:/var/lib/redis:/sbin/nologin
--- 40,46 ----
  sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
  avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
  postfix:x:89:89::/var/spool/postfix:/sbin/nologin
! 1atcpdump:x:72:72::/:/sbin/nologin
  admin:x:1000:1000:admin:/home/admin:/bin/bash
  mysql:x:1001:1001::/home/mysql:/sbin/nologin
  redis:x:987:980:Redis Database Server:/var/lib/redis:/sbin/nologin


3.指定上下文行数比较

指定上下文行数,比较两个文件的不同。

比较的特殊字符:

-	出现在前者,表示后者比前者少一行
+	出现在后者,表示后者比前者多一行
-   出现在两者,表示有差别的行

[root@jeven tmp]# diff -C 2 passwd passwd01 
*** passwd	2023-03-11 18:33:21.672772433 +0800
--- passwd01	2023-03-11 18:33:39.395771582 +0800
***************
*** 16,20 ****
  polkitd:x:999:998:User for polkitd:/:/sbin/nologin
  libstoragemgmt:x:998:995:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin
! colord:x:997:994:User for colord:/var/lib/colord:/sbin/nologin
  rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
  gluster:x:996:993:GlusterFS daemons:/run/gluster:/sbin/nologin
--- 16,20 ----
  polkitd:x:999:998:User for polkitd:/:/sbin/nologin
  libstoragemgmt:x:998:995:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin
! coloa1rd:x:997:994:User for colord:/var/lib/colord:/sbin/nologin
  rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
  gluster:x:996:993:GlusterFS daemons:/run/gluster:/sbin/nologin
***************
*** 26,30 ****
  rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
  nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
! unbound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin
  chrony:x:993:988::/var/lib/chrony:/sbin/nologin
  qemu:x:107:107:qemu user:/:/sbin/nologin
--- 26,30 ----
  rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
  nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
! un1abound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin
  chrony:x:993:988::/var/lib/chrony:/sbin/nologin
  qemu:x:107:107:qemu user:/:/sbin/nologin
***************
*** 41,45 ****
  avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
  postfix:x:89:89::/var/spool/postfix:/sbin/nologin
! tcpdump:x:72:72::/:/sbin/nologin
  admin:x:1000:1000:admin:/home/admin:/bin/bash
  mysql:x:1001:1001::/home/mysql:/sbin/nologin
--- 41,45 ----
  avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
  postfix:x:89:89::/var/spool/postfix:/sbin/nologin
! 1atcpdump:x:72:72::/:/sbin/nologin
  admin:x:1000:1000:admin:/home/admin:/bin/bash
  mysql:x:1001:1001::/home/mysql:/sbin/nologin



4.以联合 (unified) 模式比较差异

以联合 (unified) 模式比较差异

第一部分,显示两个文件的基本信息。---表示第一个文件,+++ 表示第二个文件。
第二部分,@@包围的内容,其中 -15,7 表示输出的内容属于第一个文件的第15行和第21行,+15,7 表示输出的内容属于第二个文件的第15行到第21号,进行合并显示。
第三部分,为比较后合并的内容。减号 -为变化的部分中第一个文件内容,加号表示变化中第二个文件改变的内容


[root@jeven tmp]# diff -u passwd passwd01 
--- passwd	2023-03-11 18:33:21.672772433 +0800
+++ passwd01	2023-03-11 18:33:39.395771582 +0800
@@ -15,7 +15,7 @@
 dbus:x:81:81:System message bus:/:/sbin/nologin
 polkitd:x:999:998:User for polkitd:/:/sbin/nologin
 libstoragemgmt:x:998:995:daemon account for libstoragemgmt:/var/run/lsm:/sbin/nologin
-colord:x:997:994:User for colord:/var/lib/colord:/sbin/nologin
+coloa1rd:x:997:994:User for colord:/var/lib/colord:/sbin/nologin
 rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
 gluster:x:996:993:GlusterFS daemons:/run/gluster:/sbin/nologin
 saslauth:x:995:76:Saslauthd user:/run/saslauthd:/sbin/nologin
@@ -25,7 +25,7 @@
 radvd:x:75:75:radvd user:/:/sbin/nologin
 rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
 nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin/nologin
-unbound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin
+un1abound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nologin
 chrony:x:993:988::/var/lib/chrony:/sbin/nologin
 qemu:x:107:107:qemu user:/:/sbin/nologin
 tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/sbin/nologin
@@ -40,7 +40,7 @@
 sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
 avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/sbin/nologin
 postfix:x:89:89::/var/spool/postfix:/sbin/nologin
-tcpdump:x:72:72::/:/sbin/nologin
+1atcpdump:x:72:72::/:/sbin/nologin
 admin:x:1000:1000:admin:/home/admin:/bin/bash
 mysql:x:1001:1001::/home/mysql:/sbin/nologin
 redis:x:987:980:Redis Database Server:/var/lib/redis:/sbin/nologin



5.以并列输出

比较两个文件的不同,且并列输出文件的全部内容。

比较的特殊字符:
| 表示前后 2 个文件内容有不同
< 表示后面文件比前面文件少了 1 行内容
> 表示后面文件比前面文件多了 1 行内容
[root@jeven tmp]# diff -y passwd passwd01 
root:x:0:0:root:/root:/bin/bash					root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin				bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin				daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin				adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin			lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
sync:x:5:0:sync:/sbin:/bin/sync					sync:x:5:0:sync:/sbin:/bin/sync
shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown			shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown
halt:x:7:0:halt:/sbin:/sbin/halt				halt:x:7:0:halt:/sbin:/sbin/halt
mail:x:8:12:mail:/var/spool/mail:/sbin/nologin			mail:x:8:12:mail:/var/spool/mail:/sbin/nologin
operator:x:11:0:operator:/root:/sbin/nologin			operator:x:11:0:operator:/root:/sbin/nologin
games:x:12:100:games:/usr/games:/sbin/nologin			games:x:12:100:games:/usr/games:/sbin/nologin
ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin			ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin
nobody:x:99:99:Nobody:/:/sbin/nologin				nobody:x:99:99:Nobody:/:/sbin/nologin
systemd-network:x:192:192:systemd Network Management:/:/sbin/	systemd-network:x:192:192:systemd Network Management:/:/sbin/
dbus:x:81:81:System message bus:/:/sbin/nologin			dbus:x:81:81:System message bus:/:/sbin/nologin
polkitd:x:999:998:User for polkitd:/:/sbin/nologin		polkitd:x:999:998:User for polkitd:/:/sbin/nologin
libstoragemgmt:x:998:995:daemon account for libstoragemgmt:/v	libstoragemgmt:x:998:995:daemon account for libstoragemgmt:/v
colord:x:997:994:User for colord:/var/lib/colord:/sbin/nologi |	coloa1rd:x:997:994:User for colord:/var/lib/colord:/sbin/nolo
rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin	rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/sbin/nologin
gluster:x:996:993:GlusterFS daemons:/run/gluster:/sbin/nologi	gluster:x:996:993:GlusterFS daemons:/run/gluster:/sbin/nologi
saslauth:x:995:76:Saslauthd user:/run/saslauthd:/sbin/nologin	saslauth:x:995:76:Saslauthd user:/run/saslauthd:/sbin/nologin
abrt:x:173:173::/etc/abrt:/sbin/nologin				abrt:x:173:173::/etc/abrt:/sbin/nologin
rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin			rtkit:x:172:172:RealtimeKit:/proc:/sbin/nologin
pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin	pulse:x:171:171:PulseAudio System Daemon:/var/run/pulse:/sbin
radvd:x:75:75:radvd user:/:/sbin/nologin			radvd:x:75:75:radvd user:/:/sbin/nologin
rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin	rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin
nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin	nfsnobody:x:65534:65534:Anonymous NFS User:/var/lib/nfs:/sbin
unbound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/nol |	un1abound:x:994:989:Unbound DNS resolver:/etc/unbound:/sbin/n
chrony:x:993:988::/var/lib/chrony:/sbin/nologin			chrony:x:993:988::/var/lib/chrony:/sbin/nologin
qemu:x:107:107:qemu user:/:/sbin/nologin			qemu:x:107:107:qemu user:/:/sbin/nologin
tss:x:59:59:Account used by the trousers package to sandbox t	tss:x:59:59:Account used by the trousers package to sandbox t
usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin			usbmuxd:x:113:113:usbmuxd user:/:/sbin/nologin
geoclue:x:992:986:User for geoclue:/var/lib/geoclue:/sbin/nol	geoclue:x:992:986:User for geoclue:/var/lib/geoclue:/sbin/nol
ntp:x:38:38::/etc/ntp:/sbin/nologin				ntp:x:38:38::/etc/ntp:/sbin/nologin
sssd:x:991:985:User for sssd:/:/sbin/nologin			sssd:x:991:985:User for sssd:/:/sbin/nologin
setroubleshoot:x:990:984::/var/lib/setroubleshoot:/sbin/nolog	setroubleshoot:x:990:984::/var/lib/setroubleshoot:/sbin/nolog
saned:x:989:983:SANE scanner daemon user:/usr/share/sane:/sbi	saned:x:989:983:SANE scanner daemon user:/usr/share/sane:/sbi
gdm:x:42:42::/var/lib/gdm:/sbin/nologin				gdm:x:42:42::/var/lib/gdm:/sbin/nologin
gnome-initial-setup:x:988:982::/run/gnome-initial-setup/:/sbi	gnome-initial-setup:x:988:982::/run/gnome-initial-setup/:/sbi
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/no	sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/no
avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/	avahi:x:70:70:Avahi mDNS/DNS-SD Stack:/var/run/avahi-daemon:/
postfix:x:89:89::/var/spool/postfix:/sbin/nologin		postfix:x:89:89::/var/spool/postfix:/sbin/nologin
tcpdump:x:72:72::/:/sbin/nologin			      |	1atcpdump:x:72:72::/:/sbin/nologin
admin:x:1000:1000:admin:/home/admin:/bin/bash			admin:x:1000:1000:admin:/home/admin:/bin/bash
mysql:x:1001:1001::/home/mysql:/sbin/nologin			mysql:x:1001:1001::/home/mysql:/sbin/nologin
redis:x:987:980:Redis Database Server:/var/lib/redis:/sbin/no	redis:x:987:980:Redis Database Server:/var/lib/redis:/sbin/no
zhangsan:x:1002:1002::/home/zhangsan:/bin/bash			zhangsan:x:1002:1002::/home/zhangsan:/bin/bash
lisi:x:1003:1003::/home/lisi:/bin/bash				lisi:x:1003:1003::/home/lisi:/bin/bash
kitty:x:1004:1004::/home/kitty:/bin/bash			kitty:x:1004:1004::/home/kitty:/bin/bash
apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin		apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin
[root@jeven tmp]# 



【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。