find
The find
utility is a really versatile tool. It has a wide range of options, as you can see if you look at the manual pages for find
:
man find
The book Unix Power Tools dedicates all of chapter 9 to the find
command.
For instance, you can see all of the files and directories in the AirBnB directory (and all of the directories recursively contained in there as well):
find /anvil/projects/tdm/data/airbnb/ -print
You can use the find
command to find all of the files and directories in your current directory and in any subdirectories and sub-sub-directories, etc. (Be sure to think about where you are using this, because if there are millions of files and directories in your current directory, find
will try to print them all!)
find . -print
For instance, you could navigate to the AirBnb data directory and then print all of the files and directories inside. (This is equivalent to the earlier example.)
`cd /anvil/projects/tdm/data/airbnb/`
`find . -print`
If you want to see all of the ls -la
information about each file and directory in the current directory, you can run ls -la
on each line of find . -print
as follows:
ls -ld `find . -print`
To find all files in the current directory (or any subdirectories) that have the file extension ".adoc" we can run:
find . -name "*.adoc" -print
or, similarly, we could find all "pdf" files in the current directory (or any subdirectories)
find . -name "*.pdf" -print