wc command with examples in Linux / Unix

wc command with examples in Linux / Unix

wc command is used to print number of lines, words and bytes in a file. The abbreviation of wc is word count. wc command is the most easy way to find number of lines in a file. Mostly every one use wc command to find number of lines in a file.

Word Count wc command with examples in Linux / Unix
In the below example wc command prints the number of lines, words and character present in the /etc/passwd file.

#wc /etc/passwd
123  165 5261 /etc/passwd
|    |   |
|    |   |
|    |   |_____Their are total of 5261 character in /etc/passwd file.
|    |
|    |______Their are total of 165 words in /etc/passwd file.
|
|_______ Their are total of 123 lines in /etc/passwd file.

Options of wc command:

-c — Prints the byte counts

-l — Prints the line counts

-w — Prints the word counts

-L — Print the length of the longest line

How to find number of lines in a file

#wc -l /etc/passwd

How to find number of words in a file

#wc -l /etc/passwd

How to find number of character in a file

#wc -c /etc/passwd

How to find the length of the longest line

#wc -L /etc/passwd

16 wc command with examples in Linux / Unix

Share and Enjoy

  • wp socializer sprite mask 32px wc command with examples in Linux / Unix
  • wp socializer sprite mask 32px wc command with examples in Linux / Unix
  • wp socializer sprite mask 32px wc command with examples in Linux / Unix
  • wp socializer sprite mask 32px wc command with examples in Linux / Unix
  • wp socializer sprite mask 32px wc command with examples in Linux / Unix
  • wp socializer sprite mask 32px wc command with examples in Linux / Unix
  • wp socializer sprite mask 32px wc command with examples in Linux / Unix
  • wp socializer sprite mask 32px wc command with examples in Linux / Unix

Leave a Reply

Your email address will not be published. Required fields are marked *


9 × = seventy two

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Protected by WP Anti Spam