WC Commands Cheat Sheet

Here is a cli commands cheat sheet for WC command, you can use this as a quick reminder for basic commands with a brief description for each of the commands.

What is WC command?

Add some data here

        # To count the number of words (file or STDIN):
wc -w 
cat  | wc -w

# To count the number of lines (file or STDIN):
wc -l 
cat  | wc -l

# To count the number of bytes (file or STDIN):
wc -c 
cat  | wc -c

# To count files and directories at a given location:
ls | wc -l

# To if you ever use `wc` in a shell script and need to compare the output with an int you can
# clean the output (wc returns extra characters around the integer) by using xargs:
ls -l | wc -l | xargs
    

Check out the WC command documentation .


You can also check our MegaSh cheatsheet tool, that has 150+ searchable linux cheat sheets in one page, so you never forget a command as you work again

Check Also

Best AI tools list