How to watch file count in a directory (Linux/macOS)?

If you want to monitor file count in some directory simply use this:

watch "ls -A | wc -l"

You can also mask specific files using asterisk char:

watch "ls sess* -A | wc -l"

If you get Argument list too long error, please change command syntax to this:

watch "ls -U | grep -c '^sess'"

Published by

Konrad Fedorczyk

I'm interested in programming and gamedev. I especially luv HTML5 and everything connected to web technologies.

Leave a Reply

Your email address will not be published.