View file commands in Linux

Source: Internet
Author: User

Cat command: View file contents

Example: cat-n/etc/passwd view passwd file and add line number

Cat-b/etc/passwd view passwd file blank Line No line number

CAT-NS/ETC/PASSWD view passwd file plus line number and multiple consecutive blank lines Yasuo to one line

More command: View file contents

For example: MORE/ETC/PASSWD view passwd file Press Enter down a line, press the space down one screen. (but not upside down)

Less command: View file contents

Use the up and down keys to flip.


Head command: View the contents of the file (typically used for directional lookups) (the first 10 lines are displayed by default)

For example: Head-n 5/etc/passwd View the first 5 lines of the passwd file.

Tail Command: View the contents of the file (10 rows by default) (Count backwards)

For example: Tail-n 3/etc/passwd View the passwd file after 3 lines.

Example: Head-n 5/etc/passwd | Tail-n 3 View the last 3 lines of the first 5 rows in the passwd file.


View file commands in Linux

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.