Head in Linux, TAIL,WC command

Source: Internet
Author: User


There are several commands for reading files in the Linux system: Head, tail, WC. Let's explain these commands.


1. Head: Show Previous lines

Head file: Display 1-10 rows (default is 10 rows)

Head-n file: Display 1-20 rows
Head-n -20 file: Displays 1-120 rows, 20 means no 20 rows are displayed


2. Tail: Show the following linesTail, similar to head, only describes the usage of "+":
Tail-n +100 file: Displays 10-140 rows, +100 means the first 99 rows are not displayed
If you want to display 10~20 line: head-n | Tail-n 10 This is a pipe command.

3. WC: How many words in the query file, how many lines, how many charactersExample: cat/etc/man.config | WC
- L: How many rows are listed- W: How many words are listed- m: lists how many characters


Head in Linux, TAIL,WC command

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