Linux File Content View command

Source: Internet
Author: User

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

Cat starts displaying file contents from the first line

The TAC begins with the last line, and you can see that the TAC is backwards written 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 can page forward!

Head's just a few lines.

Tail only look at the tail a few lines


Cat

Cat [-abentv]

Options and Parameters:
-A: Equivalent to-vet's integration options, you can list some special characters rather than blanks;
-B: List line numbers, do line numbers for non-blank lines only, 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, and the file contents start with the last line



nl


NL [-BNW] File

Options and Parameters:
-B: Specifies the way the line number is specified, mainly in two ways:
-B A: Indicates that the line number (similar to cat-n) is also listed, whether or not it is a blank line;
-B T: If there is a blank line, the empty line does not list the row number (default);
-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: line number in its own field to the right of the display, and add 0;
-W: The number of digits occupied by the line number field.


MoreIn the more of this program running, you have several keys that you can press:

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.



LessThe commands you can enter at run time are:

Blank key: Flip one Page down;
[PageDown]: flipping down one page;
[PageUp]: Flip up one page;
/string: Search down the function of "string";
Word string: Search for "string" function;
N: Repeat the previous search (with/or?) )
N: Reverse the repetition of the previous search (with/or?)! )
Q: Leave less this program;



Head
Head [-N number] File

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



Tail

tail [-N number] File

Options and Parameters:
-N: followed by a number that represents the meaning of a few lines
-F: Indicates continuous detection of the following file name, wait until [ctrl]-c] to end the detection of tail

Linux File Content View command

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.