View file contents of Linux commands

Source: Internet
Author: User

1 Cat: View file contents

Option:-B Displays line numbers, blank lines do not display line numbers

-N Displays line numbers, including blank lines

[[Email protected] ~] #cat-B a.txt


2 more: Page view the contents of the file, press space to view the next page, press Q to exit

[[Email protected] ~] #more a.txt


3 Less: Paging through the contents of the file, using the same way as VI, space (next page), B Key (previous), G (last line), G (first row)

[Email protected] ~]# LESS/ETC/PASSWD


4 Head: View the contents of the file header, default to the first 10 lines

Option:-N to display the contents of the top N rows

[Email protected] ~]# HEAD-20/ETC/PASSWD


5 Tail: View the contents of the end of the file, default to the last 10 lines

Option:-n Displays the contents of the end of the file n rows

-F Dynamic display of file contents, usually used to view the log, CTRL + C exit

[Email protected] ~]# TAIL-20/ETC/PASSWD


6 WC: Displays the statistics of the file's lines, words, and bytes

Option:-c displays statistics for bytes

-l Display Row count statistics

-W Display word statistics

[Email protected] ~]# wc-w a.txt


7 grep: Find keywords and print matching lines

Option:-I ignores case

-V to reverse match

--color Display Color

[Email protected] ~]# grep--color Minion A.txt


8 Echo: Displays the specified string

Option:-N does not wrap, the default echo output is wrapped.

[Email protected] ~]# echo-n C



This article from "10,000 years too long, seize" blog, please be sure to keep this source http://zengwj1949.blog.51cto.com/10747365/1916434

View file contents of Linux commands

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.