Ubuntu: Find number of files in folder and sub folders? Question: I want to find the total count of the number of files under a folder and all its sub folders. Solutions Sample (Please watch the whole video to see all solutions, in order of how many people found them helpful): == This solution helped 10 people == The fastest and easiest way, is to use tree. Its speed is limited by your output terminal, so if you pipe the result to tail -1, you'll get immediate result. You can also control to what directory level you like the results, using the -L option. For colorized output, use -C. For example: $ tree share/some/directory/ | tail -1 558 directories, 853 files $ tree -L 2 share/some/directory/ | tail -1 120 directories, 3 files If it's not already there, you can get it ftp://mama.indstate.edu/linux/tree/. == This solution helped 11 people == To count files (even files without an extension) at the root of the current directory, use: ls l | grep ^ | wc -l To count files (even files without an extension) recursively from the root of the current directory, use: ls lR | grep ^ | wc -l == This solution helped 197 people == May be something like find . -type f | wc -l would do the trick. Try the command from the parent folder. == This solution helped 1 person == find seems to be quicker than tree so I used below to count files in each directory of the current working directory (ignoring files in CWD) with allowing directories to have spaces: ls -d */ | while read dir_line do echo -n "$dir_line :" find "$dir_line" -type f | wc -l done == This solution helped 25 people == Use the tree command. You might need to install the tree package. It will list all the files and folders under the given folder and list a summary at the end. == This solution helped 2 people == Use this command for each folder in the path for D in *; do echo $D; find $D -type f| wc -l; done With thanks & praise to God! With thanks to the many people who have made this project possible! | Content (except music & images) licensed under cc by-sa 3.0 | Music: https://www.bensound.com/royalty-free... | Images: https://stocksnap.io/license & others | With thanks to user user unknown (https://askubuntu.com/users/10068), user user38537 (https://askubuntu.com/users/347507), user topless (https://askubuntu.com/users/1177), user tinlyx (https://askubuntu.com/users/282488), user Sriram Murali (https://askubuntu.com/users/30615), user Seth (https://askubuntu.com/users/44179), user sagarchalise (https://askubuntu.com/users/1543), user not2qubit (https://askubuntu.com/users/236076), user Mike Bounds (https://askubuntu.com/users/570766), user Egil (https://askubuntu.com/users/13570), and the Stack Exchange Network (http://stackoverflow.com/questions/34.... Trademarks are property of their respective owners. Disclaimer: All information is provided "AS IS" without warranty of any kind. You are responsible for your own actions. Please contact me if anything should be amiss at Roel D.OT VandePaar A.T gmail.com.