http://stackoverflow.com – Today when I was using the "find" command. It is a little bit confusing on the usage. The problem: I want to count how many gz files under the main directory. However, the main dir also have sub directories. e.g. /mainDir/Dir1/1/ /mainDir/Dir2/1/2012. Under each sub folder, there are several gz files. I use command 1, it works fine. First I go the the main directory: ls -R . | find -name "*.gz" | wc -l However, if I use command 2, it return 0: ls -R /home/user1/data1/2012/mainDir | find -name "*.gz" | wc -l What is the reason, Any one got some idea? thanks, (HowTos)