WC Command in Linux Explained with the real time Examples!!

Check the Word Count of a File using WC Command!!



C Command in Linux: WC stands for Word Count It is used to find out number of linesword countbytes and characters count in the given file. This article will assist you to use WC command in Linux Kubuntu 19.10.

Jump To

Note: Currently we are using Linux Kubuntu 19.10 for the purpose of demonstration of WC command in Linux

WC Command Syntax:

wc [OPTION]… [FILE]…

This is a basic syntax of WC command in Linux.

WC Command Options:

The options below may be used to select which counts are printed, always in
the following order: newline, word, character, byte, maximum line length.
-c, --bytes            print the byte counts
-m, --chars            print the character counts
-l, --lines            print the newline counts
--files0-from=F    read input from the files specified by
NUL-terminated names in file F;
If F is - then read names from standard input
-L, --max-line-length  print the maximum display width
-w, --words            print the word counts
--help     display this help and exit
--version  output version information and exit

WC Command Examples:

Let’s check the word count of the text file “LXD” and the syntax is,

wc LXD

This command displays the Number of Lines, Words, and Characters in the given file.

WC Command Example 1
WC Command Example 1
wc -l LXD

-l: This command displays the Number of Lines in the given file.

WC Command Example 2
WC Command Example 2
wc -w LXD

-w: This command displays the Number of Words in the given file.

Check this too  How to use Halt Command in Linux Ubuntu 19.10/18.04 LTS?
WC Command Example 3
WC Command Example 3
wc -c LXD

-c: This command displays the Count of bytes in the given file.

WC Command Example 4
WC Command Example 4
wc -m LXD

-m: This command displays the Number of Characters in the given file.

WC Command Example 5
WC Command Example 5

Wc Version Check Command:

wc --version

WC Version Check
WC Version Check

WC Command Help Options:

  • Launch the terminal by pressing the shortcut keys CTRL+ALT+T.
  • Execute the following command.
wc --help

WC Help Option
WC Help Option

A Short summary:

We hope that the above article shows you the directions and the guidelines to work with the WC Command in Linux with practical examples and screenshots. Please let us know if you have any queries regarding this article. Share your valuable suggestion in the comment section. Thank you for visiting our website Tec Robust.

Leave a Reply

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

Install microstack on Kubuntu

How install the MicroStack on Linux Kubuntu 19.10?

Install juju for Kubuntu

How to Install the juju Modelling Tool for Kubuntu 19.10!