Huu Phan | Blog Linux operating system | Linux operating system -Blog Huu Phan | Powered by Blogger.

Explore the world of seamless email management with Zimbra Mail on Linux! Our blog delves into a step-by-step guide on harnessing the potential of Linux commands, providing easy-to-follow how-tos, and unlocking the magic of Bash scripting. Simplify your email administration journey and enhance your skills with our insightful tips and tricks.

Counting, Reporting, and Beyond: wc command in Linux


In this tutorial, How to use wc command in Linux. it is one of the core Linux utilities, no need to install it.

In the expansive realm of Linux command-line utilities, the "wc" command stands as a compact yet powerful tool that plays a pivotal role in assessing textual data. Short for "word count," the "wc" command offers more than just counting words. It is a versatile Swiss Army knife for analyzing files and generating insightful reports.

You can counts the lines, words, and bytes in a file or selection of file. etc.

wc command in Linux

The simplest way to use wc command as below:


As the picture, wc command scan the file and count the line, words, and bytes and display terminal windows.

You can pass multiple files to wc command.

wc command line option

The display lines in file

How to words in a file

Display characters in file use -m option

the length of the longest line in a file

Use piping input to wc command to  count the occurrences of each extension type.

 find ./* -type f | rev | cut -d'.' -f1 | rev | sort | uniq

 find ./* -type f | rev | cut -d'.' -f1 | rev | sort | uniq | wc -l

In conclusion

The "wc" command's unassuming name belies its substantial capabilities in the Linux command-line toolkit. Its proficiency in counting lines, words, and characters, along with its adaptability through various options, makes it an invaluable tool for both casual users and seasoned administrators. 

Whether employed for quick information retrieval or integrated into complex automation scripts, the "wc" command stands as a testament to the efficiency and versatility that defines the Linux command-line ecosystem.

post new :

Huu Phan | Blog Linux operating system | Huu Phan ~ Zimbra Mail Server,linux,bash script,centos,linux command |

This Blog is protected by