WC command with examples
This is a small post on how to us wc(Word Count) command in Linux and Unix. WC command is a basic command which can give you good statics of the file content such as
- Number of characters
- Number of words
- Number of Lines
In all these options get number of lines of a file/output is frequently used. Lets learn wc command with examples
Example1: How can display or get number of character in my file?
wc -c filename.txt
Example2: I want to count number of words in a file in Linux, how can I do that?
wc -w filename.txt
Example3: Count number of lines in a given file output
wc -l filename.txt
Example4: How can I get number of files in a given directory
ls | wc -l
To get more help on wc command read man pages
The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.
Latest posts by Surendra Anne (see all)
- Understanding AWS “The services” Part – II - June 8, 2016
- Understanding AWS(Amazon Web services) “The Cloud” Part – I - May 11, 2016
- 16 ls command examples for newbe - April 20, 2016
- Understanding DOCKER containers in Linux? - April 19, 2016
- What is puppet? Why Linux/Unix users require it? - April 13, 2016