diff

显示两个文件之间的差异,或两个目录中的每个相应文件。
对于相同的文件,diff通常不产生输出;
对于二进制(非文本)文件,diff通常仅显示它们是不同的。

语法

diff [options] FILES

选项

多个单字母选项(除非它们带参数)可以组合成一个命令行字:所以-ac'相当于-a -c’

FILES are ‘FILE1 FILE2’ or ‘DIR1 DIR2’ or ‘DIR FILE…’ or ‘FILE… DIR’.
如果给出–from-file或–to-file,则对FILES没有限制。
如果FILE是’ - ',则读取标准输入

   -a
   --text
       将所有文件视为文本.

   -b
    --ignore-space-change
        忽略空白字符
   -B
    --ignore-blank-lines
        忽略空白行

   -c NUM
   -C NUM
   --context[=NUM]
       显示全部内容,并标出不同之处
       NUM (default 3)

   -d
   --minimal
       尝试发现更小的变化.

   -e
   --ed
       输出ed脚本.

   -E
   --ignore-tab-expansion
       忽略由于标签扩展而导致的更改

   -F RE
   --show-function-line=RE
       显示最近匹配RE的行

   --help
       输出帮助

   --horizon-lines=NUM
       保留公共前缀和后缀的NUM行

   -i
   --ignore-case
       忽略文件内容中的大小写差异.

   --ignore-file-name-case
       忽略文件名大小写

   --no-ignore-file-name-case
       不忽略文件名大小写

   --label LABEL
       使用LABEL而不是文件名

   --left-column
       仅输出公共线的左列

   -l
   --paginate
        通过'pr'传递输出以对其进行分页.

   -N
   --new-file
       将缺失文件视为空
   --normal
       输出正常差异

   -n
   --rcs
       输出RCS格式差异.

   -p
   --show-c-function
       显示每个更改的C函数. 

   -q
   --brief
       仅输出文件是否不同.

   -r
   --recursive
       递归比较找到的所有子目录.

   --strip-trailing-cr
       末尾带回车输入

   -S FILE
   --starting-file=FILE
        比较目录时从FILE开始.

   -s
   --report-identical-files
       报告两个文件是否相同.

   --speed-large-files
       假设大文件有许多零散的小变化

   --suppress-common-lines
       不输出公共线

   -t
   --expand-tabs
       在输出时,将tab字符展开

   -T
   --initial-tab
       在每行前面加上tab字符以便对齐.

   --unidirectional-new-file
       将缺少的第一个文件视为空.

   -u NUM
   -U NUM
   --unified[=NUM]
       以合并的方式来显示文件内容的不同
   -v
   --version
      输出版本信息.

   -w
   --ignore-all-space
       忽略所有空白区域.

   -W NUM
   --width=NUM
       输出最多NUM(默认130)打印列.

   -x PAT
   --exclude=PAT
       排除与PAT匹配的文件.

   -X FILE
   --exclude-from=FILE
       排除与FILE中任何模式匹配的文件.

   -y
   --side-by-side
       输出两列.

   --from-file=FILE1
       将FILE1与所有操作数进行比较。FILE1可以是目录. 

   --to-file=FILE2
      将所有操作数与FILE2进行比较。FILE2可以是目录 


    -D NAME
    --ifdef=NAME
       输出合并文件以显示 '#ifdef NAME' 差异.

    --GTYPE-group-format=GFMT
       类似, 但使用GFMT格式化GTYPE输入组.

    -I REGEXP
    --ignore-matching-lines=REGEXP
       忽略其行全部与REGEXP匹配的更改 

    --line-format=LFMT
       类似,但使用LFMT格式化所有输入行。

    --LTYPE-line-format=LFMT
       类似,但与格式LTYPE输入线LFMT。


     GFMT 包含:
     %<       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

     LFMT can contain:
     %L       contents of line 
     %l       contents of line, excluding any trailing newline 
     %[-][WIDTH][.[PREC]]{doxX}n
        printf-style spec for input line number

     Either GFMT or LFMT can contain:
     %%        % 
    %c'C'     The single character C 
    %c'\OOO'  The character with octal code OOO 

在最简单的情况下,diff会比较两个文件的内容.

如果源文件是一个目录, 没有目标文件,DIFF比较了从文件名到文件内容,非目录文件不能是 -

如果源文件和目标文件都是目录,则diff按字母顺序比较两个目录中的相应文件; 除非给出-r或–recursive选项,否则此比较不是递归的。

End -of-Line
在区分文本和二进制文件的操作系统中,`diff’通常以文本形式读取和写入所有数据。

使用--binary'选项强制diff’来读写二进制数据。此选项对符合Posix的系统(如GNU或传统Unix)没有影响。但是,许多个人计算机操作系统一行的结尾,回车后跟换行符

在这样的系统上,diff'通常忽略输入上的这些回车并在每个输出行的末尾生成它们,但是使用–binary’选项`diff’将每个回车处理为另一个输入字符,而不是在每个输出行的末尾生成一个回车符。

在处理与Posix兼容系统互换的非文本文件时,这非常有用

忽略大小写

GNU`diff’可以将小写字母视为等同于它们的大写字母

不匹配正则表达式的行
要忽略与正则表达式匹配的行的插入和删除,请使用 -I REGEXP' 或–ignore-matching-lines=REGEXP’ 选项.
您应该转义包含shell元字符的正则表达式,以防止shell扩展它们.

如, diff -I ‘[1]’ 忽略对以数字开头的行的所有更改

但是,-I如果块中的每个更改行(每次插入和每次删除)与正则表达式匹配,则忽略包含正则表达式的行的插入或删除。

换句话说,对于每个不可忽略的变化,“diff”打印其附近的整套变化,包括可忽略的变化。您可以通过使用多个-I'选项为要忽略的行指定多个正则表达式。diff’尝试将每一行与每个正则表达式匹配,从给定的最后一个开始。

实例

$ diff -q <(sort file1.txt | uniq) <(sort file2.txt | uniq)

上面的命令将return 0
如果 file1.txt = file2.txt file1.txt ≠ file2.txt return 1
注意必须首先对文件进行排序(顺序很重要),如果文件可能包含重复值,则必须通过uniq命令运行sort的输出以消除任何重复的元素


  1. 0-9 ↩︎

diff 命令实例:

linux命令:diff <(!!) <(!-2) <(!-2) <(!!) diff diff <(!!) <(!-2)rootopen.com
linux命令:diff <(!!) <(!-2) <(!-2) <(!!) diff diff <(!!) <(!-2)rootopen.com
2019-07-09 21:19:21

linux命令:diff <(jq . -M -S < old.json) <(jq . -M -S < new.json) new.json) < -S -M . <(jq old.json) < -S -M . <(jq diff diff <(jq . -M -S < old.json) <(jq . -M -S < new.json)rootopen.com
linux命令:diff <(jq . -M -S < old.json) <(jq . -M -S < new.json) new.json) < -S -M . <(jq old.json) < -S -M . <(jq diff diff <(jq . -M -S < old.json) <(jq . -M -S < new.json)rootopen.com
2018-10-17 23:33:30

linux命令:diff file1 file2 file2 file1 diff diff file1 file2rootopen.com
linux命令:diff file1 file2 file2 file1 diff diff file1 file2rootopen.com
2018-08-29 21:32:54

linux命令:diff <(sort file1) <(sort file2) file2) <(sort file1) <(sort diff diff <(sort file1) <(sort file2)rootopen.com
linux命令:diff <(sort file1) <(sort file2) file2) <(sort file1) <(sort diff diff <(sort file1) <(sort file2)rootopen.com
2018-04-14 15:58:48

linux命令:diff -q dir1/ dir2/ | grep differ | awk '{ print "vimdiff " $2 " " $4 }' }' $4 " " $2 " "vimdiff print '{ awk | differ grep | dir2/ dir1/ -q diff diff -q dir1/ dir2/ | grep differ | awk '{ print "vimdiff " $2 " " $4 }'rootopen.com
linux命令:diff -q dir1/ dir2/ | grep differ | awk '{ print "vimdiff " $2 " " $4 }' }' $4 " " $2 " "vimdiff print '{ awk | differ grep | dir2/ dir1/ -q diff diff -q dir1/ dir2/ | grep differ | awk '{ print "vimdiff " $2 " " $4 }'rootopen.com
2018-03-13 08:37:48

linux命令:diff <(head -500 product-feed.xml) <(head -500 product-feed.xml.old) product-feed.xml.old) -500 <(head product-feed.xml) -500 <(head diff diff <(head -500 product-feed.xml) <(head -500 product-feed.xml.old)rootopen.com
linux命令:diff <(head -500 product-feed.xml) <(head -500 product-feed.xml.old) product-feed.xml.old) -500 <(head product-feed.xml) -500 <(head diff diff <(head -500 product-feed.xml) <(head -500 product-feed.xml.old)rootopen.com
2018-01-15 08:34:48

linux命令:diff <(ssh nx915000 "rpm -qa") <(ssh nx915001 "rpm -qa") -qa") "rpm nx915001 <(ssh -qa") "rpm nx915000 <(ssh diff diff <(ssh nx915000 "rpm -qa") <(ssh nx915001 "rpm -qa")rootopen.com
linux命令:diff <(ssh nx915000 "rpm -qa") <(ssh nx915001 "rpm -qa") -qa") "rpm nx915001 <(ssh -qa") "rpm nx915000 <(ssh diff diff <(ssh nx915000 "rpm -qa") <(ssh nx915001 "rpm -qa")rootopen.com
2018-03-21 03:20:48

linux命令:diff dir1 dir2 | diffstat diffstat | dir2 dir1 diff diff dir1 dir2 | diffstatrootopen.com
linux命令:diff dir1 dir2 | diffstat diffstat | dir2 dir1 diff diff dir1 dir2 | diffstatrootopen.com
2018-01-17 13:27:48

linux命令:diff <(sort file1.txt) <(sort file2.txt) file2.txt) <(sort file1.txt) <(sort diff diff <(sort file1.txt) <(sort file2.txt)rootopen.com
linux命令:diff <(sort file1.txt) <(sort file2.txt) file2.txt) <(sort file1.txt) <(sort diff diff <(sort file1.txt) <(sort file2.txt)rootopen.com
2018-04-02 09:59:48

linux命令:diff3 -a file1 file2 file3 file3 file2 file1 -a diff3 diff3 -a file1 file2 file3rootopen.com
linux命令:diff3 -a file1 file2 file3 file3 file2 file1 -a diff3 diff3 -a file1 file2 file3rootopen.com
2018-01-25 21:06:48

linux命令:diff <(nmap -sP 192.168.1.0/24 | grep ^Host | sed 's/.appears to be up.//g' | sed 's/Host //g') auth.hosts | sed 's/[0-9][a-z,A-Z][0-9]$//' | sed 's/</UNAUTHORIZED IP -/g' -/g' IP 's/</UNAUTHORIZED sed | 's/[0-9][a-z,A-Z][0-9]$//' sed | auth.hosts //g') 's/Host sed | up.//g' be to 's/.appears sed | ^Host grep | 192.168.1.0/24 -sP <(nmap diff diff <(nmap -sP 192.168.1.0/24 | grep ^Host | sed 's/.appears to be up.//g' | sed 's/Host //g') auth.hosts | sed 's/[0-9][a-z,A-Z][0-9]$//' | sed 's/</UNAUTHORIZED IP -/g'rootopen.com
linux命令:diff <(nmap -sP 192.168.1.0/24 | grep ^Host | sed 's/.appears to be up.//g' | sed 's/Host //g') auth.hosts | sed 's/[0-9][a-z,A-Z][0-9]$//' | sed 's/</UNAUTHORIZED IP -/g' -/g' IP 's/</UNAUTHORIZED sed | 's/[0-9][a-z,A-Z][0-9]$//' sed | auth.hosts //g') 's/Host sed | up.//g' be to 's/.appears sed | ^Host grep | 192.168.1.0/24 -sP <(nmap diff diff <(nmap -sP 192.168.1.0/24 | grep ^Host | sed 's/.appears to be up.//g' | sed 's/Host //g') auth.hosts | sed 's/[0-9][a-z,A-Z][0-9]$//' | sed 's/</UNAUTHORIZED IP -/g'rootopen.com
2018-05-26 06:39:48

linux命令:diff <(ssh alice cat /etc/apt/sources.list) <(ssh bob cat /etc/apt/sources.list) /etc/apt/sources.list) cat bob <(ssh /etc/apt/sources.list) cat alice <(ssh diff diff <(ssh alice cat /etc/apt/sources.list) <(ssh bob cat /etc/apt/sources.list)rootopen.com
linux命令:diff <(ssh alice cat /etc/apt/sources.list) <(ssh bob cat /etc/apt/sources.list) /etc/apt/sources.list) cat bob <(ssh /etc/apt/sources.list) cat alice <(ssh diff diff <(ssh alice cat /etc/apt/sources.list) <(ssh bob cat /etc/apt/sources.list)rootopen.com
2018-04-12 16:20:48

linux命令:diff <(cd dir1 && find | sort) <(cd dir2 && find | sort) sort) | find && dir2 <(cd sort) | find && dir1 <(cd diff diff <(cd dir1 && find | sort) <(cd dir2 && find | sort)rootopen.com
linux命令:diff <(cd dir1 && find | sort) <(cd dir2 && find | sort) sort) | find && dir2 <(cd sort) | find && dir1 <(cd diff diff <(cd dir1 && find | sort) <(cd dir2 && find | sort)rootopen.com
2018-02-12 03:07:48

linux命令:diff -uw <(fmt -1 {file1, file2}) file2}) {file1, -1 <(fmt -uw diff diff -uw <(fmt -1 {file1, file2})rootopen.com
linux命令:diff -uw <(fmt -1 {file1, file2}) file2}) {file1, -1 <(fmt -uw diff diff -uw <(fmt -1 {file1, file2})rootopen.com
2018-04-19 06:33:48

linux命令:diff -urp /originaldirectory /modifieddirectory /modifieddirectory /originaldirectory -urp diff diff -urp /originaldirectory /modifieddirectoryrootopen.com
linux命令:diff -urp /originaldirectory /modifieddirectory /modifieddirectory /originaldirectory -urp diff diff -urp /originaldirectory /modifieddirectoryrootopen.com
2018-05-02 03:34:48

linux命令:diff <(echo "$a") <(echo "$b") "$b") <(echo "$a") <(echo diff diff <(echo "$a") <(echo "$b")rootopen.com
linux命令:diff <(echo "$a") <(echo "$b") "$b") <(echo "$a") <(echo diff diff <(echo "$a") <(echo "$b")rootopen.com
2018-05-03 22:26:48

linux命令:diff <(cd /path-1; find . -type f -print | egrep -i '\.m4a$|\.mp3$') <(cd /path-2; find . f -print | egrep -i '\.m4a$|\.mp3$') '\.m4a$|\.mp3$') -i egrep | -print f . find /path-2; <(cd '\.m4a$|\.mp3$') -i egrep | -print f -type . find /path-1; <(cd diff diff <(cd /path-1; find . -type f -print | egrep -i '\.m4a$|\.mp3$') <(cd /path-2; find . f -print | egrep -i '\.m4a$|\.mp3$')rootopen.com
linux命令:diff <(cd /path-1; find . -type f -print | egrep -i '\.m4a$|\.mp3$') <(cd /path-2; find . f -print | egrep -i '\.m4a$|\.mp3$') '\.m4a$|\.mp3$') -i egrep | -print f . find /path-2; <(cd '\.m4a$|\.mp3$') -i egrep | -print f -type . find /path-1; <(cd diff diff <(cd /path-1; find . -type f -print | egrep -i '\.m4a$|\.mp3$') <(cd /path-2; find . f -print | egrep -i '\.m4a$|\.mp3$')rootopen.com
2018-02-24 11:26:48

linux命令:diff <(openssl x509 -noout -modulus -in server.crt ) <( openssl rsa -noout -modulus -in server.key ) ) server.key -in -modulus -noout rsa openssl <( ) server.crt -in -modulus -noout x509 <(openssl diff diff <(openssl x509 -noout -modulus -in server.crt ) <( openssl rsa -noout -modulus -in server.key )rootopen.com
linux命令:diff <(openssl x509 -noout -modulus -in server.crt ) <( openssl rsa -noout -modulus -in server.key ) ) server.key -in -modulus -noout rsa openssl <( ) server.crt -in -modulus -noout x509 <(openssl diff diff <(openssl x509 -noout -modulus -in server.crt ) <( openssl rsa -noout -modulus -in server.key )rootopen.com
2018-01-17 03:43:48

linux命令:diff <(ssh server01 'cd config; find . -type f -exec md5sum {} \;| sort -k 2') <(ssh server02 'cd config;find . -type f -exec md5sum {} \;| sort -k 2') 2') -k sort \;| {} md5sum -exec f -type . config;find 'cd server02 <(ssh 2') -k sort \;| {} md5sum -exec f -type . find config; 'cd server01 <(ssh diff diff <(ssh server01 'cd config; find . -type f -exec md5sum {} \;| sort -k 2') <(ssh server02 'cd config;find . -type f -exec md5sum {} \;| sort -k 2')rootopen.com
linux命令:diff <(ssh server01 'cd config; find . -type f -exec md5sum {} \;| sort -k 2') <(ssh server02 'cd config;find . -type f -exec md5sum {} \;| sort -k 2') 2') -k sort \;| {} md5sum -exec f -type . config;find 'cd server02 <(ssh 2') -k sort \;| {} md5sum -exec f -type . find config; 'cd server01 <(ssh diff diff <(ssh server01 'cd config; find . -type f -exec md5sum {} \;| sort -k 2') <(ssh server02 'cd config;find . -type f -exec md5sum {} \;| sort -k 2')rootopen.com
2018-04-01 09:06:48

linux命令:diff {$path1,$path2}/file_to_diff {$path1,$path2}/file_to_diff diff diff {$path1,$path2}/file_to_diffrootopen.com
linux命令:diff {$path1,$path2}/file_to_diff {$path1,$path2}/file_to_diff diff diff {$path1,$path2}/file_to_diffrootopen.com
2018-03-27 06:22:48

linux命令:diff -x "*CVS*" -r <path-1> <path-2> [<path-3>] [<path-3>] <path-2> <path-1> -r "*CVS*" -x diff diff -x "*CVS*" -r <path-1> <path-2> [<path-3>]rootopen.com
linux命令:diff -x "*CVS*" -r <path-1> <path-2> [<path-3>] [<path-3>] <path-2> <path-1> -r "*CVS*" -x diff diff -x "*CVS*" -r <path-1> <path-2> [<path-3>]rootopen.com
2018-03-25 05:43:48

linux命令:diff <(lsof -p 1234) <(sleep 10; lsof -p 1234) 1234) -p lsof 10; <(sleep 1234) -p <(lsof diff diff <(lsof -p 1234) <(sleep 10; lsof -p 1234)rootopen.com
linux命令:diff <(lsof -p 1234) <(sleep 10; lsof -p 1234) 1234) -p lsof 10; <(sleep 1234) -p <(lsof diff diff <(lsof -p 1234) <(sleep 10; lsof -p 1234)rootopen.com
2018-02-12 19:26:48

linux命令:diff <(tail -10 file1) <(tail -10 file2) file2) -10 <(tail file1) -10 <(tail diff diff <(tail -10 file1) <(tail -10 file2)rootopen.com
linux命令:diff <(tail -10 file1) <(tail -10 file2) file2) -10 <(tail file1) -10 <(tail diff diff <(tail -10 file1) <(tail -10 file2)rootopen.com
2018-05-13 16:15:48

linux命令:diff -wubBEr -x .svn dirA dirB dirB dirA .svn -x -wubBEr diff diff -wubBEr -x .svn dirA dirBrootopen.com
linux命令:diff -wubBEr -x .svn dirA dirB dirB dirA .svn -x -wubBEr diff diff -wubBEr -x .svn dirA dirBrootopen.com
2018-03-26 18:18:48

linux命令:diff <(perl -wpl -e '$_ =~ s/^\s+|\s+$//g ;' file1) <(perl -wpl -e '$_ =~ s/^\s+|\s+$//g ;' file2) file2) ;' s/^\s+|\s+$//g =~ '$_ -e -wpl <(perl file1) ;' s/^\s+|\s+$//g =~ '$_ -e -wpl <(perl diff diff <(perl -wpl -e '$_ =~ s/^\s+|\s+$//g ;' file1) <(perl -wpl -e '$_ =~ s/^\s+|\s+$//g ;' file2)rootopen.com
linux命令:diff <(perl -wpl -e '$_ =~ s/^\s+|\s+$//g ;' file1) <(perl -wpl -e '$_ =~ s/^\s+|\s+$//g ;' file2) file2) ;' s/^\s+|\s+$//g =~ '$_ -e -wpl <(perl file1) ;' s/^\s+|\s+$//g =~ '$_ -e -wpl <(perl diff diff <(perl -wpl -e '$_ =~ s/^\s+|\s+$//g ;' file1) <(perl -wpl -e '$_ =~ s/^\s+|\s+$//g ;' file2)rootopen.com
2018-02-05 19:20:48

linux命令:diff -b $file1 $file2 # GNU Tools Tools GNU # $file2 $file1 -b diff diff -b $file1 $file2 # GNU Toolsrootopen.com
linux命令:diff -b $file1 $file2 # GNU Tools Tools GNU # $file2 $file1 -b diff diff -b $file1 $file2 # GNU Toolsrootopen.com
2018-01-15 22:29:48

linux命令:diff <(ssh user@host1 cat /path/to/file) <(ssh user@host2 cat /path/to/file2) /path/to/file2) cat user@host2 <(ssh /path/to/file) cat user@host1 <(ssh diff diff <(ssh user@host1 cat /path/to/file) <(ssh user@host2 cat /path/to/file2)rootopen.com
linux命令:diff <(ssh user@host1 cat /path/to/file) <(ssh user@host2 cat /path/to/file2) /path/to/file2) cat user@host2 <(ssh /path/to/file) cat user@host1 <(ssh diff diff <(ssh user@host1 cat /path/to/file) <(ssh user@host2 cat /path/to/file2)rootopen.com
2018-02-04 15:39:48

linux命令:diff <(wget -q -O - URL1) <(wget -q -O - URL2) URL2) - -O -q <(wget URL1) - -O -q <(wget diff diff <(wget -q -O - URL1) <(wget -q -O - URL2)rootopen.com
linux命令:diff <(wget -q -O - URL1) <(wget -q -O - URL2) URL2) - -O -q <(wget URL1) - -O -q <(wget diff diff <(wget -q -O - URL1) <(wget -q -O - URL2)rootopen.com
2018-02-05 17:53:48

linux命令:diff -ua <(w3m -dump http://www.php.net/downloads.php|fgrep -A1 '5.2.15 (tar.bz2)'|awk '/md5:/{print $2}') <(md5sum php-5.2.15.tar.bz2|awk '{print $1}') $1}') '{print php-5.2.15.tar.bz2|awk <(md5sum $2}') '/md5:/{print (tar.bz2)'|awk '5.2.15 -A1 http://www.php.net/downloads.php|fgrep -dump <(w3m -ua diff diff -ua <(w3m -dump http://www.php.net/downloads.php|fgrep -A1 '5.2.15 (tar.bz2)'|awk '/md5:/{print $2}') <(md5sum php-5.2.15.tar.bz2|awk '{print $1}')rootopen.com
linux命令:diff -ua <(w3m -dump http://www.php.net/downloads.php|fgrep -A1 '5.2.15 (tar.bz2)'|awk '/md5:/{print $2}') <(md5sum php-5.2.15.tar.bz2|awk '{print $1}') $1}') '{print php-5.2.15.tar.bz2|awk <(md5sum $2}') '/md5:/{print (tar.bz2)'|awk '5.2.15 -A1 http://www.php.net/downloads.php|fgrep -dump <(w3m -ua diff diff -ua <(w3m -dump http://www.php.net/downloads.php|fgrep -A1 '5.2.15 (tar.bz2)'|awk '/md5:/{print $2}') <(md5sum php-5.2.15.tar.bz2|awk '{print $1}')rootopen.com
2018-03-16 16:45:48

linux命令:diff <(md5sum render_pack.zip| cut -d " " -f 1) <(md5sum /media/green/render_pack.zip| cut -d " " -f 1);echo $? $? 1);echo -f " " -d cut /media/green/render_pack.zip| <(md5sum 1) -f " " -d cut render_pack.zip| <(md5sum diff diff <(md5sum render_pack.zip| cut -d " " -f 1) <(md5sum /media/green/render_pack.zip| cut -d " " -f 1);echo $?rootopen.com
linux命令:diff <(md5sum render_pack.zip| cut -d " " -f 1) <(md5sum /media/green/render_pack.zip| cut -d " " -f 1);echo $? $? 1);echo -f " " -d cut /media/green/render_pack.zip| <(md5sum 1) -f " " -d cut render_pack.zip| <(md5sum diff diff <(md5sum render_pack.zip| cut -d " " -f 1) <(md5sum /media/green/render_pack.zip| cut -d " " -f 1);echo $?rootopen.com
2018-06-08 22:16:48

linux命令:diff <(lsusb) <(sleep 3s && lsusb) lsusb) && 3s <(sleep <(lsusb) diff diff <(lsusb) <(sleep 3s && lsusb)rootopen.com
linux命令:diff <(lsusb) <(sleep 3s && lsusb) lsusb) && 3s <(sleep <(lsusb) diff diff <(lsusb) <(sleep 3s && lsusb)rootopen.com
2018-05-21 12:25:48

linux命令:diff -Naur --strip-trailing-cr --strip-trailing-cr -Naur diff diff -Naur --strip-trailing-crrootopen.com
linux命令:diff -Naur --strip-trailing-cr --strip-trailing-cr -Naur diff diff -Naur --strip-trailing-crrootopen.com
2018-03-01 08:56:48

linux命令:diff --changed-group-format='differs from line %dF to line %dL|' --unchanged-line-format='' $FILE1 $FILE2 | sed 's/|/\n/' 's/|/\n/' sed | $FILE2 $FILE1 --unchanged-line-format='' %dL|' line to %dF line from --changed-group-format='differs diff diff --changed-group-format='differs from line %dF to line %dL|' --unchanged-line-format='' $FILE1 $FILE2 | sed 's/|/\n/'rootopen.com
linux命令:diff --changed-group-format='differs from line %dF to line %dL|' --unchanged-line-format='' $FILE1 $FILE2 | sed 's/|/\n/' 's/|/\n/' sed | $FILE2 $FILE1 --unchanged-line-format='' %dL|' line to %dF line from --changed-group-format='differs diff diff --changed-group-format='differs from line %dF to line %dL|' --unchanged-line-format='' $FILE1 $FILE2 | sed 's/|/\n/'rootopen.com
2018-02-10 03:46:48

linux命令:diff rpm_output_from_other_computer <(rpm -qa|sort) -qa|sort) <(rpm rpm_output_from_other_computer diff diff rpm_output_from_other_computer <(rpm -qa|sort)rootopen.com
linux命令:diff rpm_output_from_other_computer <(rpm -qa|sort) -qa|sort) <(rpm rpm_output_from_other_computer diff diff rpm_output_from_other_computer <(rpm -qa|sort)rootopen.com
2018-04-10 18:01:48

linux命令:diff -rq dirA dirB dirB dirA -rq diff diff -rq dirA dirBrootopen.com
linux命令:diff -rq dirA dirB dirB dirA -rq diff diff -rq dirA dirBrootopen.com
2018-06-03 10:42:48

linux命令:diff -U 9999 file_a file_b | tail -n +3 | grep -P "^(\ Header|\-|\+)" Header|\-|\+)" "^(\ -P grep | +3 -n tail | file_b file_a 9999 -U diff diff -U 9999 file_a file_b | tail -n +3 | grep -P "^(\ Header|\-|\+)"rootopen.com
linux命令:diff -U 9999 file_a file_b | tail -n +3 | grep -P "^(\ Header|\-|\+)" Header|\-|\+)" "^(\ -P grep | +3 -n tail | file_b file_a 9999 -U diff diff -U 9999 file_a file_b | tail -n +3 | grep -P "^(\ Header|\-|\+)"rootopen.com
2018-01-13 19:07:48

linux命令:diffxml() { diff -wb <(xmllint --format "$1") <(xmllint --format "$2"); } } "$2"); --format <(xmllint "$1") --format <(xmllint -wb diff { diffxml() diffxml() { diff -wb <(xmllint --format "$1") <(xmllint --format "$2"); }rootopen.com
linux命令:diffxml() { diff -wb <(xmllint --format "$1") <(xmllint --format "$2"); } } "$2"); --format <(xmllint "$1") --format <(xmllint -wb diff { diffxml() diffxml() { diff -wb <(xmllint --format "$1") <(xmllint --format "$2"); }rootopen.com
2018-06-09 20:15:48

linux命令:diff -r -u originDir updateDir > result.patch result.patch > updateDir originDir -u -r diff diff -r -u originDir updateDir > result.patchrootopen.com
linux命令:diff -r -u originDir updateDir > result.patch result.patch > updateDir originDir -u -r diff diff -r -u originDir updateDir > result.patchrootopen.com
2018-02-09 11:12:48

linux命令:diff -ru originDir updateDir > result.patch result.patch > updateDir originDir -ru diff diff -ru originDir updateDir > result.patchrootopen.com
linux命令:diff -ru originDir updateDir > result.patch result.patch > updateDir originDir -ru diff diff -ru originDir updateDir > result.patchrootopen.com
2018-02-09 22:02:48

linux命令:diff -U99999 original.css modified.css | awk '/^-/{next} {f=f"\n"$0} /^\+.*[^ ]/{yes=1} /}/ {if(yes){print f} f="";yes=0}' f="";yes=0}' f} {if(yes){print /}/ ]/{yes=1} /^\+.*[^ {f=f"\n"$0} '/^-/{next} awk | modified.css original.css -U99999 diff diff -U99999 original.css modified.css | awk '/^-/{next} {f=f"\n"$0} /^\+.*[^ ]/{yes=1} /}/ {if(yes){print f} f="";yes=0}'rootopen.com
linux命令:diff -U99999 original.css modified.css | awk '/^-/{next} {f=f"\n"$0} /^\+.*[^ ]/{yes=1} /}/ {if(yes){print f} f="";yes=0}' f="";yes=0}' f} {if(yes){print /}/ ]/{yes=1} /^\+.*[^ {f=f"\n"$0} '/^-/{next} awk | modified.css original.css -U99999 diff diff -U99999 original.css modified.css | awk '/^-/{next} {f=f"\n"$0} /^\+.*[^ ]/{yes=1} /}/ {if(yes){print f} f="";yes=0}'rootopen.com
2018-02-05 02:46:48

linux命令:diff <(exiftool img_1.jpg) <(exiftool img_2.jpg) img_2.jpg) <(exiftool img_1.jpg) <(exiftool diff diff <(exiftool img_1.jpg) <(exiftool img_2.jpg)rootopen.com
linux命令:diff <(exiftool img_1.jpg) <(exiftool img_2.jpg) img_2.jpg) <(exiftool img_1.jpg) <(exiftool diff diff <(exiftool img_1.jpg) <(exiftool img_2.jpg)rootopen.com
2018-03-06 06:13:48

linux命令:diff -y <(ssh user@host find /boot|sort) <(find /boot|sort) /boot|sort) <(find /boot|sort) find user@host <(ssh -y diff diff -y <(ssh user@host find /boot|sort) <(find /boot|sort)rootopen.com
linux命令:diff -y <(ssh user@host find /boot|sort) <(find /boot|sort) /boot|sort) <(find /boot|sort) find user@host <(ssh -y diff diff -y <(ssh user@host find /boot|sort) <(find /boot|sort)rootopen.com
2018-06-12 02:44:48

linux命令:diff --suppress-common-lines -y <(cd path_to_dir1; find .|sort) <(cd path_to_dir2; find .|sort) .|sort) find path_to_dir2; <(cd .|sort) find path_to_dir1; <(cd -y --suppress-common-lines diff diff --suppress-common-lines -y <(cd path_to_dir1; find .|sort) <(cd path_to_dir2; find .|sort)rootopen.com
linux命令:diff --suppress-common-lines -y <(cd path_to_dir1; find .|sort) <(cd path_to_dir2; find .|sort) .|sort) find path_to_dir2; <(cd .|sort) find path_to_dir1; <(cd -y --suppress-common-lines diff diff --suppress-common-lines -y <(cd path_to_dir1; find .|sort) <(cd path_to_dir2; find .|sort)rootopen.com
2018-05-28 05:46:48

linux命令:diff -dbByw $COLUMNS FILE1 FILE2 FILE2 FILE1 $COLUMNS -dbByw diff diff -dbByw $COLUMNS FILE1 FILE2rootopen.com
linux命令:diff -dbByw $COLUMNS FILE1 FILE2 FILE2 FILE1 $COLUMNS -dbByw diff diff -dbByw $COLUMNS FILE1 FILE2rootopen.com
2018-05-02 14:34:48

linux命令:diff -Naur /source/path /target/path --brief | awk '{print "cp " $2 " " $4}' | sh sh | $4}' " " $2 " "cp '{print awk | --brief /target/path /source/path -Naur diff diff -Naur /source/path /target/path --brief | awk '{print "cp " $2 " " $4}' | shrootopen.com
linux命令:diff -Naur /source/path /target/path --brief | awk '{print "cp " $2 " " $4}' | sh sh | $4}' " " $2 " "cp '{print awk | --brief /target/path /source/path -Naur diff diff -Naur /source/path /target/path --brief | awk '{print "cp " $2 " " $4}' | shrootopen.com
2018-05-12 21:08:48

linux命令:diff <(ssh user@host cat /path/to/remotefile) /path/to/localfile /path/to/localfile /path/to/remotefile) cat user@host <(ssh diff diff <(ssh user@host cat /path/to/remotefile) /path/to/localfilerootopen.com
linux命令:diff <(ssh user@host cat /path/to/remotefile) /path/to/localfile /path/to/localfile /path/to/remotefile) cat user@host <(ssh diff diff <(ssh user@host cat /path/to/remotefile) /path/to/localfilerootopen.com
2018-02-26 13:16:48

linux命令:diff ../source-dir.orig/ ../source-dir.post/ | grep "Only in" | sed -e 's/^.*\:.\(\<.*\>\)/\1/g' | xargs rm -r -r rm xargs | 's/^.*\:.\(\<.*\>\)/\1/g' -e sed | in" "Only grep | ../source-dir.post/ ../source-dir.orig/ diff diff ../source-dir.orig/ ../source-dir.post/ | grep "Only in" | sed -e 's/^.*\:.\(\<.*\>\)/\1/g' | xargs rm -rrootopen.com
linux命令:diff ../source-dir.orig/ ../source-dir.post/ | grep "Only in" | sed -e 's/^.*\:.\(\<.*\>\)/\1/g' | xargs rm -r -r rm xargs | 's/^.*\:.\(\<.*\>\)/\1/g' -e sed | in" "Only grep | ../source-dir.post/ ../source-dir.orig/ diff diff ../source-dir.orig/ ../source-dir.post/ | grep "Only in" | sed -e 's/^.*\:.\(\<.*\>\)/\1/g' | xargs rm -rrootopen.com
2018-02-02 15:16:48

linux命令:diff -u <(ssh -t user@host1 sudo cat /dir1/file1) <(ssh -t user@host2 sudo cat /dir2/file2) /dir2/file2) cat sudo user@host2 -t <(ssh /dir1/file1) cat sudo user@host1 -t <(ssh -u diff diff -u <(ssh -t user@host1 sudo cat /dir1/file1) <(ssh -t user@host2 sudo cat /dir2/file2)rootopen.com
linux命令:diff -u <(ssh -t user@host1 sudo cat /dir1/file1) <(ssh -t user@host2 sudo cat /dir2/file2) /dir2/file2) cat sudo user@host2 -t <(ssh /dir1/file1) cat sudo user@host1 -t <(ssh -u diff diff -u <(ssh -t user@host1 sudo cat /dir1/file1) <(ssh -t user@host2 sudo cat /dir2/file2)rootopen.com
2018-01-12 14:51:48

linux命令:diff <(cd dir1 && find . | sort) <(cd dir2 && find . | sort) sort) | . find && dir2 <(cd sort) | . find && dir1 <(cd diff diff <(cd dir1 && find . | sort) <(cd dir2 && find . | sort)rootopen.com
linux命令:diff <(cd dir1 && find . | sort) <(cd dir2 && find . | sort) sort) | . find && dir2 <(cd sort) | . find && dir1 <(cd diff diff <(cd dir1 && find . | sort) <(cd dir2 && find . | sort)rootopen.com
2018-05-04 04:17:48

linux命令:diff -qr <dir1> <dir2> <dir2> <dir1> -qr diff diff -qr <dir1> <dir2>rootopen.com
linux命令:diff -qr <dir1> <dir2> <dir2> <dir1> -qr diff diff -qr <dir1> <dir2>rootopen.com
2018-03-17 09:56:48

Linux的Bash命令行(A-Z排序)