find – Is a Linux/Unix command DIR_NAME – A directory path to search for. Use dot (.) to start search from current directory -type f – Search for files only (do not include directories) Pipe (|) – Pipe sends output of one command as input to other command wc -l – Count number of lines in result
Count files within current directory
Use the following command to count the number of available files under the current directory. Here dot (.) denotes to the current directory.
Count files in specific directory
To count files under any other directory use the following command. Here the command will find all files under the /backup directory and print total count on screen.