Linux programming file Operations Linux Knowledge Learning

Source: Internet
Author: User

Linux file content Viewis aLinuxOperations , the following is an essentialLinuxview a summary of the commands under common file content.

1. Cat starts displaying the contents of the file from the first line


Cat-a is equivalent to-vet 's integration options, which can list some special characters rather than blanks;

Cat-b List line number, only for non-blank lines to do line number display, blank line is not marked line number;

Cat-e The end of the break-break byte $ display;

Cat-n printed travel numbers, along with blank lines, will have line numbers, unlike the-B option;

Cat-t the [tab] button to display ^i;

Cat-v lists some special characters that cannot be seen;

2. The TAC starts displaying the contents of the file from the last line

Tac-b Add a separator mark before the line and not at the end;

Tac-r The separation mark as a regular expression to parse;

Tac-s uses the specified string instead of line break as the separator flag;

3. NL display line number

Nl-b a travel number, whether or not it is a blank line;

Nl-b T blank line does not list line numbers;

Nl-n LN line number is displayed on the left of the screen ;

The Nl-n RN line number is displayed on the very right of its own field and does not add 0;

Nl-n RZ line number in its own field on the right of the display, and add 0;

Nl-w the number of digits occupied by the row number field;

4. more page-by-page display file contents

while the more program is running, you can press the following key:

Blank Key (space) : Represents a page down;

Enter: Represents a downward turn "line";

/ string: Represents the keyword in this display, down search for "string";

: F: Immediately display the file name and the number of lines currently displayed;

Q: The delegate immediately leaves more and no longer displays the contents of the file.

b or [Ctrl]-b: Represents a page back, but this action is only useful for files and useless for pipelines.

5. Less is similar to more, but better than more , he can page forward

The commands you can enter at run time are:

Blank key: Flip one Page down;

[PageDown] : Flip one page down;

[PageUp] : Flip one page up;

/ string: Search down the function of "string";

? string: Search up the function of "string";

N: Repeat the previous search ( with / or ?) about! ) ;

N: Reverse the repetition of the previous search ( and / or ?) about! ) ;

Q: Leave less this program;

6. Head shows the first few lines


Head-n followed by numbers, representing the number of rows displayed;

7. Tail show the following lines

Tail-n followed by numbers, representing the number of rows displayed;

Tail-f means continuous detection of the following file name, to wait until the [ctrl]-c will end tail detection;

the above is a more commonly used Linux file Content view command , this article only makes the simple grammar introduction, the concrete usage, but also needs to look for the study!

Linux programming file Operations Linux Knowledge Learning

Related Article

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: 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.