wc command in linux with flags | Pro Tech guides

wc command in linux with flags

wc command in linux allows you to print a count of new lines, words and bytes for each input file. You can also use various flags to print.

wc command in linux with | flags | Examples

wc command in linux
wc command in linux

Hello, guys Today I am going to show you how you can use the "wc" command in Linux.

"wc" command prints a count of new lines, words and bytes for each input file.

You can use "wc" command with a file and it's going to show you the number of lines, number of words and number of characters in the file.

So let's see how You can use it,

wc command

For example, I have a file "demo.txt" file. I am going to give "wc demo.txt" and press ENTER 

Simple wc command
wc command

$wc fileName
Now you can see it gives this kind of output.

The first output here is "1" and this is the number of line in this file. "5" indicates No.of words in the file and then the third is the No.of characters here so the total number of character in this file is "21".


Using flags with wc Command

You can use certain flags in "wc" command which will give you specifically what you want.


[-c] flag

wc command with -c flag
wc command with -c flag

$wc -c fileName

If you want to print only the No.of character then you can just use a flag called "-c" and this is going to print only the number of characters.


[-l] flag

wc command with -l flag
wc command with -l flag

$wc -l fileName

If you want to count the number of lines you can just use the "-l" flag with "wc" command and then press ENTER it gives you No.of lines.


[-w] flag

wc command with -w flag
wc command with -w flag

$wc -w fileName
If you are going to use "-w" flag. It's going to give you the number of words only.

[-L] flag

wc command with -L flag
wc command with -L flag

$wc -L fileName
You can also use a flag called "-L" and this prints the No.of character in the longest line.

Conclusion

So these are the flag you can use with the WC command.

I hope you enjoyed this tutorial, THANK YOU.

HAVE A NICE DAY💕

Name

Apps,3,Games,1,Linux,38,Linux Commands,37,Network-Devices,1,Networking,1,Terminal Apps,2,Termux,17,Userland,3,Windows,1,
ltr
item
Pro Tech guides: wc command in linux with flags
wc command in linux with flags
wc command in linux allows you to print a count of new lines, words and bytes for each input file. You can also use various flags to print.
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFxsUc_Viz4EWhbnW4Ha-Z0CXhFwYtHrfp09dIcdP7FXdEyexHCOHwYmORg_997QG2Dy3Zwm48V1JUeWYWj5v1ATAQTalatTDpAwOY4opUXoBUoyJYUo9-cYc4R405u-scKgrcnveB3ek/s16000/wc-command-in-linux.png
https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhFxsUc_Viz4EWhbnW4Ha-Z0CXhFwYtHrfp09dIcdP7FXdEyexHCOHwYmORg_997QG2Dy3Zwm48V1JUeWYWj5v1ATAQTalatTDpAwOY4opUXoBUoyJYUo9-cYc4R405u-scKgrcnveB3ek/s72-c/wc-command-in-linux.png
Pro Tech guides
https://devops-digest.blogspot.com/2021/02/wc-command-in-linux-with-flags.html
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/
https://devops-digest.blogspot.com/2021/02/wc-command-in-linux-with-flags.html
true
7053638852026728047
UTF-8
Loaded All Posts Not found any posts VIEW ALL Readmore Reply Cancel reply Delete By Home PAGES POSTS View All RECOMMENDED FOR YOU LABEL ARCHIVE SEARCH ALL POSTS Not found any post match with your request Back Home Sunday Monday Tuesday Wednesday Thursday Friday Saturday Sun Mon Tue Wed Thu Fri Sat January February March April May June July August September October November December Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec just now 1 minute ago $$1$$ minutes ago 1 hour ago $$1$$ hours ago Yesterday $$1$$ days ago $$1$$ weeks ago more than 5 weeks ago Followers Follow THIS PREMIUM CONTENT IS LOCKED STEP 1: Share to a social network STEP 2: Click the link on your social network Copy All Code Select All Code All codes were copied to your clipboard Can not copy the codes / texts, please press [CTRL]+[C] (or CMD+C with Mac) to copy Table of Content