To count how many files there are in a directory using the terminal on a Linux machine you can combine 2 commands:
- find
- wc
We’ll use the find command to locate all the files (and exclude directories and other non-files) and then the wc command to count the files.