Compaction Basic Linux------Five commands per day:

Source: Internet
Author: User

Command one:

Cat opens the contents of a file, or splicing two file contents and outputs

-N or--number the number of rows for all outputs starting from 1
-B or--number-nonblank and-n similar, except for blank lines not numbered
-S or--squeeze-blank when you encounter a blank line that has more than two consecutive lines, replace the blank line with one line
-V or--show-nonprinting

Add a line number to the Textfile1 file and enter the Textfile2 file.
Cat-n textfile1 > Textfile2

Command two:

Diff compares the differences between files.

syntax:diff [-abbcdefhilnnppqrsttuvwy][-< rows >][-c < rows >][-d < macro name >][-i < character or string >][-s < File >][-w < width >][-x < file or directory >][-x < file >][--help][--left-column][--suppress-common-line][file or directory 1][ File or directory 2]

Note:diff compares the similarities and differences of text files in a row-by-line manner. Specifies that to compare directories, diff compares files of the same file name in the directory, but does not compare subdirectories.

Parameters:
-< lines > Specifies how many lines of text to display. This parameter must be used in conjunction with the-C or-u parameter.
The-A or--text diff preset will only compare text files line by row.
-B or--ignore-space-change do not check for differences in whitespace characters.
-B or--ignore-blank-lines does not check for blank lines.
-C Displays all the text and marks the difference.
-c< lines > or--context< lines > is the same as executing the-c-< lines > directive.
-D or--minimal use different algorithms to compare in smaller units.
-d< Macro name > or ifdef< macro name > The output format of this parameter is available for the predecessor Processor macro.
-E or--ed the output format of this parameter is available for the ed script file.
The-f or-forward-ed output is formatted like an ED script file, but is displayed differently in the order of the original files.
-h or--speed-large-files can speed up when comparing large files.
-l< characters or Strings > or--ignore-matching-lines< characters or strings > If two files differ in a few lines, and these lines both contain the characters or strings specified in the option, the differences between the two files are not displayed.
-I or--ignore-case do not check for differences in case.
-L or--paginate the results to the PR program for paging.
-N or--rcs displays the comparison results in RCS format.
-N or--new-file when comparing directories, if file a appears only in a directory, the preset displays:
Only in directory: If file a uses the-n parameter, diff compares file A to a blank file.
-P If the file is compared to a C language code file, the name of the function where the difference is displayed.
-P or--unidirectional-new-file is similar to-N, but this file is compared to a blank file only if the second directory contains a file that is not in the first directory.
-Q or--brief display only if there is no difference, no detailed information is displayed.
-R or--recursive to compare files in subdirectories.
-S or--report-identical-files if no differences are found, the message is still displayed.
-s< file > or--starting-file< file > compares directories, starting from the specified file.
-T or--expand-tabs expands the tab character when it is output.
-T or--initial-tab the tab character before each line to align.
-u,-u< number of columns > or--unified=< columns > displays the contents of the file differently in a merged manner.
-V or--version displays version information.
-W or--ignore-all-space ignores all whitespace characters.
-w< width > or--width< width > Specifies the width of the column when using the-y parameter.
-x< filename or directory > or--exclude< filename or directory > does not compare the file or directory specified in the option.
-x< file > or--exclude-from< file > You can save the file or directory type as a text file, and then specify the text file in =< file >.
-Y or--side-by-side displays the similarities and differences of the files in a parallel manner.
--help display Help.
--left-column when using the-y parameter, if the contents of one row of two files are the same, the contents of that row are displayed only in the field on the left.
--suppress-common-lines displays only the differences when using the-y parameter.

Command three:

File identification type

Additional note: through the file directive, we are able to identify the type of the document.

Parameters
-B The file name is not displayed when the identification results are listed.
-C Displays the instruction execution process in detail to facilitate troubleshooting or analysis of the execution of the program.
-f< name File > Specify a name file with the contents of one or more file names, let file identify these files sequentially, in the format of one file name per column.
-L Displays the category of the file that the symbolic connection points to directly.
-m< Magic Digital File > Specify Magic Digital file.
-V Displays version information.
-Z try to interpret the contents of the compressed file.

Command four:

Chattr (change attribute)

Feature Description: change file properties.

syntax:chattr [-rv][-v< version number >][+/-/=< properties >][file or directory ...]

Additional Note: This directive alters the file or directory attributes stored on the ext2 file system, which have the following 8 modes:
A: Make the file or directory available for additional use only.
B: Do not update the last access time of the file or directory.
C: Compress the file or directory and store it.
D: Exclude files or directories from dumping operations.
I: Do not alter the file or directory arbitrarily.
S: Privacy delete files or directories.
S: Update files or directories instantly.
U: Remove outside of prevention.

Parameters
-R recursively handles all files and subdirectories under the specified directory.
-v< version number > set file or directory version.
-V Displays the instruction execution process.
+< Properties > Open the Item property of the file or directory.
-< Properties > Close the Item property of the file or directory.
The =< property > Specifies the Item property of the file or directory.

Command five:

Diffstat (differential status)

function Description: The statistics are displayed according to diff comparison results.

syntax:diff [-wv][-n < filename length >][-p < filename length;]

add:diffstat read the output of diff, and then count the various files to insert, delete, modify and so on difference metering.

Parameters
-n< filename length > Specifies the length of the file name, the length must be greater than or equal to the longest file name in all files.
The-p< filename length > is the same as the-n parameter, but here the < filename length > includes the path to the file.
-W Specifies the width of the field at the output.
-V Displays version information.

Compaction Basic Linux------Five commands per day:

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.