wc Command In Linux | Linux count characters in line or file

Blogs ❯❯ Linux

Image could not load

Image by pixabay

What is wc Command in Linux ?

Linux में wc command का use किसी file में words / line व characters count करने के लिए किया जाता है। हालाँकि इसमें और भी options होते हैं जिन्हे आप wc --help command run करके देख सकते हैं।

$ wc --help

Linux wc Command Example

Example के लिए हम एक test name की file बनाकर उसमे content insert करेंगे , फिर wc command का use करके word count करेंगे

$ toch test
$ cat > test 
hello ! 
how are you? 
I hope , you are getting it :)
press ctrl+d to save and exit.

Note* Linux में touch command का use file create करने cat command का use file में content write और concatenate करने के लिए किया जाता है।

wc word Count

File content में word count करने के लिए -w option का use किया जाता है।

$ wc -w test
13 test

wc Count Lines

File में lines print करने के लिए -l option का use किया जाता है।

$ wc -l test
3 test

wc Print Characters

characters print करने के लिए -m option का use किया जाता है।

$ wc -m test
52 test

wc Print byte Counts

byte counts, print करने के लिए -c parameter का use किया जाता है।

$ wc -c test
52 test
Recent Blogs

Loading ...

Rahul Kumar

Rahul Kumar

Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)

Get connected with me. :) LinkedIn Twitter Instagram Facebook