1 / 4

Understanding Basic Command Line Utilities: wc, head, and tail

This guide covers three essential command line utilities: `wc`, `head`, and `tail`. The `wc` command counts words, lines, and characters in a file, allowing users to check file statistics quickly. The `head` command displays the first N lines of a file, which is useful for previewing data. Conversely, the `tail` command shows the last N lines, often utilized for monitoring log files. Learn the syntax and see examples to enhance your command line skills and streamline your workflow.

cody-poole
Download Presentation

Understanding Basic Command Line Utilities: wc, head, and tail

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The | Symbol Accept stdin Accept stdin cmd A cmd B cmd C Generate stdout Generate stderr Generate stderr Generate stdout Generate stderr Generate stdout Example: $ ps –ef | more $ ls | more $ ls sort –r | more

  2. wc (word count) Definition: Counts words, lines, and characters in a file. Syntax: wc[-lwc] [file. . ] Examples: $ wc /etc/passwd $ wc abcde fghijkl mnoqrstuvwxyz Ctrl-d ls> ls.out | wc -w Enter Enter Enter

  3. head • The head command is used to display the first N lines of a given file Examples: $ head -2 file head [-n] [filename]

  4. tail • The tail command is used to display the last N lines of a given file Examples: $ tail -10 file tail [-n] [filename]

More Related