Open/Display Content of a File

This lesson will illustrate various ways to display content and word count of files.

wc

Definition:

wc (word count) is used to get word count, newline count, byte and characters count in the files specified in its input.

Syntax:

wc [option] [file]

Options:

Option Description
-m Print the character counts.
-c Print the byte counts.
-l Print the newline counts.
-w Print the word counts.
-L Print the length of the longest line.

Examples:

Execute the following example. Here, 6 is the number of lines, 9 is the number of words, and 65 is the number of characters.

Get hands-on with 1200+ tech skills courses.