Questions & AnswersCategory: LinuxHow to find the total number of files in a folder on Linux?
Gowri Shankar Staff asked 5 months ago

How to find the total number of files in a folder on Linux?

By default, you can use ls command to sort the names, which can take a while if there are a lot of files exiting in the directory. Also, there will be no output until all of the names are read and sorted. To get the fast output, use the ls -f option to turn off sorting.

ls -f | wc -l

Note: This will also enable -a, so ..., and other files starting with . will be counted.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.