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

这篇具有很好参考价值的文章主要介绍了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.以并列输出

比较两个文件的不同,且并列输出文件的全部内容。文章来源地址https://www.toymoban.com/news/detail-812276.html

比较的特殊字符:
| 表示前后 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]# 



到了这里,关于Linux系统之diff命令的基本使用的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • Linux系统之dstat命令的基本使用

    dstat是一个通用的系统资源统计工具,stat命令是一个用来替换vmstat、iostat、netstat、nfsstat和ifstat这些命令,是一个全能系统信息统计工具。 实时的监控cpu、磁盘、网络、IO、内存等使用情况 全能系统信息统计 安装方便快速,上手简单 功能强大,是运维的好帮手 本地环境规划

    2024年02月04日
    浏览(25)
  • linux常用命令diff

    Linux diff (diff 即 different 简写)命令用于比较文件的差异。 diff 以逐行的方式,比较文本文件的异同处。如果指定要比较目录,则diff会比较目录中相同文件名的文件,但不会比较其中子目录 diff file_1 file_2  diff 就会告诉你,这两个文件有何差异。它的显示结果不太好懂,下面我

    2024年02月10日
    浏览(36)
  • Linux运维常用awk命令使用

    awk 是一种文本处理工具,经常用于对 Linux 系统中的文本文件进行处理。 1、awk 查找指定文本 awk \\\'/orange/ {print}\\\' file.txt 这个命令将在 file.txt 文件中查找包含orange 的行,并将这些匹配的内容打印出来。 awk \\\'/pattern/ {print NR \\\":\\\" $0}\\\' file.txt 这个命令将在file.txt 文件中查找包含 patte

    2024年02月04日
    浏览(59)
  • Linux系统运维:性能监视和分析工具sar命令详解

    目          录 一、sar工具介绍 二、sar工作原理 (一)原理概述 (二)sar数据收集器 三、sar命令语法 四、sar主要功能介绍 (一)功能概述 (二)CPU统计数据 (三)磁盘I/O统计数据 (四)网络统计数据 1、是使用-n DEV选项的sar输出 2、关于网络错误的信息可以用sar -n EDE

    2024年02月21日
    浏览(60)
  • Linux | Ubuntu20.04系统使用命令从移动硬盘/U盘拷贝文件到服务器上

    *确认自己移动硬盘、U盘的格式,本文为exfat格式 查看disk默认位置 查看最后的位置,我的显示为 Device, 位置为 /dev/sdb1 ,2048, (后面省略) *注意:此时无法直接查看硬盘内容 进入Linux系统主界面,如果是user的话,获取管理员权限 挂载移动硬盘/U盘 命令如下,其中/dev/sdb1为disk默

    2024年02月14日
    浏览(36)
  • 华为云云耀云服务器L实例评测 | Linux系统宝塔运维部署H5游戏

    本章节内容,我们主要介绍华为云耀服务器L实例,从云服务的优势讲起,然后讲解华为云耀服务器L实例资源面板如何操作,如何使用宝塔运维服务,如何使用运维工具可视化安装nginx,最后部署一个自研的H5的小游戏(6岁的小朋友玩的很开心😁)。 前端的同学如果想把自己

    2024年02月07日
    浏览(46)
  • 三、Linux基本使用和常用命令

    1、登录Linux操作系统方式 1.图形化界面 基于 x window System 显示框架开发 由KDE(类似于苹果系统)、GNOME.v.3.0 提供图形化桌面环境 2.虚拟控制台 文本方式(Ctrl + Alt + F3)   3.Web网页登录 前提是需要打开网页控制台,由 cock.pit 程序提供 ‘’‘ #将cockpit控制台设置为开机启动且

    2024年02月05日
    浏览(40)
  • Linux 学习笔记(1)——系统基本配置与开关机命令

    目录 0、起步 0-1)命令使用指引 0-2)查看历史的命令记录 0-3)清空窗口内容 0-4)获取本机的内网 IP 地址 0-5)获取本机的公网ip地址 0-6)在window的命令行窗口中远程连接linux 0-7)修改系统的时间 0-8)给虚拟机配置静态 ip 地址 1、使用scp上传和下载文件 1-1)将本地文件上传到

    2024年02月10日
    浏览(29)
  • 【Linux面试题及答案:了解Linux操作系统、常见发行版及基本命令】

    一、什么是Linux操作系统? 答:Linux是一种开源的操作系统,它基于UNIX操作系统开发而来。Linux具有稳定性、可靠性和安全性的特点,并且可以运行在各种硬件平台上。 二、Linux有哪些常见的发行版? 答:Linux有许多不同的发行版,常见的有Ubuntu、Debian、CentOS、Fedora、Red Hat等

    2024年02月08日
    浏览(38)
  • 蓝易云:Linux系统sshd命令 – openssh服务器守护进程

    sshd是Linux系统中的一个守护进程,它提供了远程登录服务和安全的文件传输功能。以下是sshd的详细教程。 1. 安装openssh-server 在Debian/Ubuntu上安装openssh-server命令如下: sudo apt-get update sudo apt-get install openssh-server 在CentOS/RHEL上安装openssh-server命令如下: sudo yum update sudo yum install

    2024年02月16日
    浏览(37)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包