Linux This file command to view content

Source: Internet
Author: User

Linux system, use the following command to view the contents of the file:

Cat

The TAC starts from the last line and can see that the TAC is written backwards by cat!

NL display, the output line number!

More page-by-page display file contents

Less is similar to more, but better than more. He is able to page forward!

Head's just a few lines.

Tail just look at the tail a few lines


Cat

Cat [-abentv]

Options and number of references:
-A: Equivalent to-vet's integration options, you can list some special characters rather than blanks;
-B: Lists line numbers and displays only line numbers for non-blank lines. Blank lines are not marked with line numbers!


-E: Displays the end of the break byte $;
-N: Print the travel number, along with the blank line will also have line number, and the option of-B is different;
-T: Displays the [tab] key in ^i;
-V: Lists some special characters that can't be seen


TACThe TAC is just the opposite of the cat command. The contents of the file start from the last line



nl


NL [-BNW] File

Options and number of references:
-B: Specifies the way the line number is specified, mainly in two ways:
-B A: Indicates the same line number (similar to cat-n), whether or not it is a blank line;
-B T: Suppose you have a blank line. The empty row does not list line numbers (default values);
-N: List the method of line number representation, there are three main kinds:
-N LN: The line number is displayed at the left of the screen;
-N RN: The line number is displayed on the very right of its own field and does not add 0.
-N RZ: The line number is displayed on the very right of its own field. and add 0.
-W: The number of digits occupied by the line number field.


MoreDuring the execution of the more this program. You have several keys that you can press:

Blank Key (space): Represents a page down;
Enter: Represents a downward turn "line";
/string: Represents the content in this display, searching down the "string" for this keyword.
: F: Immediately displays the file name and the number of rows displayed at the moment;
Q: The delegate immediately leaves more and no longer displays the contents of the file.
b or [Ctrl]-b: Represents the page back, but this action is only practical for the file, the pipeline is useless.



LessThe commands you can enter when executing are:

Blank key: Flip one Page down;
[PageDown]: Flip one page down.
[PageUp]: Flip up one page;
/string: Search down the function of "string".
?

String: Search for the "string" function.
N: Repeat the previous search (with/or?)

)
N: Reverse repeated previous search (with/or?). )
Q: Leave less this program;



Head
Head [-N number] File

Options and number of references:
-N: followed by a number that represents the meaning of a few lines



Tail

tail [-N number] File

Options and number of references:
-N: followed by numbers. The representative shows the meaning of several lines
-F: Indicates the file name that is followed by the continuous detection, to wait until [ctrl]-c will end tail discovery

Copyright notice: This article Bo Master original article. Blog, not reproduced without consent.

Linux This file command to view content

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.