Linux section Seventh essay

Source: Internet
Author: User

  

Linux seventh talk (top)
1.diff http://www.cnblogs.com/peida/archive/2012/12/12/2814048.html
function: The diff command can compare individual files or directory contents. If you specify that the comparison is a file, it is only valid if the input is a text file. Compare the similarities and differences of text files in a row-by-line manner.

If you specify a table of contents, the diff command compares a text file with the same name in two directories. Lists the different binaries, common subdirectories, and files that appear only in one directory.
Parameters:-A or--text diff presets will only compare text files line by row.
-C Displays all the text and marks the difference.
-h or--speed-large-files can speed up when comparing large files.
-I or--ignore-case do not check for differences in case.
-R or--recursive to compare files in subdirectories.
-u,-u or--unified= displays the different contents of the file in a merged manner.
-Y or--side-by-side displays the similarities and differences of the files in a parallel manner.
-W or--width specifies the column width when using the-y parameter
Syntax: diff[parameter [file 1 or directory 1][file 2 or directory 2]
Diff A.log B.log
"3C3" means that the third line of the file has different
"11,12D10" means that the first file is more than the second file with lines 11th and 12
Diff A.log B.log-y-W 50
Display file details in parallel
| Indicates that the contents of the front and back 2 files are different
"<" indicates that the following file is 1 lines less than the previous file
">" indicates that the following file has 1 lines more than the previous file
Diff A.log B.log-c
Show All text
In this way, a description of the comparison file is made in the first two lines, here are three special characters:
The "+" comparison of the latter of the files is more than the previous line
"-" compares the latter of the file with a smaller line than the previous
“! "Compare files with two different lines
Diff A.log B.log-u
Unified format Output
The first part of it is also the basic information of the file:
---log2014.log 2012-12-07 18:01:54.000000000 +0800
+ + + log2013.log 2012-12-07 16:36:26.000000000 +0800
"---" means the document before the change, and "+ + +" means the document after the change.
The second part, the position of the change with two @ as the first and end.
@@ -1,12 +1,10 @@
The preceding " -1,12" is divided into three parts: the minus sign indicates the first file (that is, Log2014.log), "1" means line 1th, and "12" means 12 rows in a row.

Together, it means that the following is the first file, starting from line 1th, 12 consecutive lines. Similarly, "+1,10" means that after a change, the second file becomes a row of 10 lines starting from line 1th.

2.uniq
Function: Filter the repeating section to display the contents of the file.
Parameters:-C Displays the output, at the beginning of each line plus the number of times the bank appears in the file. It can replace the-U and-D options.
-D displays only duplicate rows.
-U displays only the rows that are not duplicated in the file.
-N the first n fields are ignored along with the white space in front of each field. A field is a non-whitespace, non-tabbed string that is separated from each other by tabs and spaces (fields are numbered starting with 0).
+n the first n characters are ignored, the previous characters are skipped (the characters are numbered starting with 0).
-FN is the same as-N, where n is the number of fields.
-SN is the same as +n, where n is the number of characters.
Syntax: Cat file | Sort | Uniq-c
View specific duplicate rows in a file

3.stat
Function: Gets the properties of the file, such as the size, last modified time
Parameter:-F Displays information about the file system (not the file)
-T shows the exact same information
Syntax: Stat file-f-T

Linux section Seventh essay

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.