English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

Comando diffstat di Linux

大全命令Linux

Il comando diffstat di Linux mostra i numeri di statistica in base ai risultati di diff.

diffstat legge l'output di diff e poi conta le differenze di inserimento, rimozione, modifica e altri metodi di differenza.

Sintassi

diff [-wV][-n <lunghezza del nome del file>][-p <lunghezza del nome del file>]

Parametro

  • -n<lunghezza del nome del file>  Specificare la lunghezza del nome del file, la lunghezza specificata deve essere maggiore o uguale alla lunghezza del nome del file più lungo tra tutti i file.
  • -p<lunghezza del nome del file>  Come il parametro -n, ma qui la <lunghezza del nome del file> include il percorso del file.
  • -w  Specificare la larghezza della colonna di output.
  • -V  Mostra informazioni di versione.

在线示例

Users can also directly use "|" to pass the output of the diff command directly to the diffstat command for the display of the statistical results.

Using this command, if the file or subdirectory to be compared is not in the current directory, you should use its complete path.

$ diff test1 test2 | diffstat   #display statistics of comparison results

Note: Using this command can very conveniently realize the function of displaying statistics.

To view the content of a file, users can view it by using the command "cat", as follows:

$ cat test1/testf.txt           #view content of test1/testf  
abc  
def  
ghi  
jkl  
mno  
pqr  
stu  
vws  
$ cat test2/testf.txt           #view content of test2/testf  
abc  
def  
ghi  
jkl  
mno

From the file content displayed above, you can see the differences between the contents of two files. Now let's run the command just now to display the statistics of the file comparison results, as follows:

testfile | 2 +-             #output information statistics  
file changed 1, insertion +1, deletion -1

大全命令Linux