Random Linux commands that I have used

By | June 1, 2015
find libblkmaker | wc -l

This counts the number of files and folders in a directory. wc stands for word count. -l prints the number of lines. | pipes the results to the wc command.

find libblkmaker -type f | wc -l

If you want to count just the files, add the criteria -type f.

grep -rc int | grep 0$ | wc -l

This searches for the “int” string recursively and provides a count. Then it finds all results with 0 (zero) occurrences and does a count on that.

grep -rc int | grep -v 0$ | wc -l

Add a -v to inverse the query and find non zero occurrences.

Leave a Reply

Your email address will not be published.