find - search for files in a directory hierarchy
find [path...] [expression]
Some basics to find are as follows:
A simple find command will list all files and folders recursively in your current working directory (CWD):
secondary ~ # find
The second argument to find is the path, which, if blank, is assumed to be your CWD, as shown previously. You can also explicitly give the path:
secondary ~ # find .
From the man page, we can see that after the path, we can give find an expression. This is where most people have trouble when starting out. The tendancy of most people is to limit themselves to a regular expression-type of expression when the bigger picture is that the expression possibilities are immense. Take the following, for example:
secondary ~ # find / -type d -name sbin
As you can see, this command listed all of the directories in the filesystem by the name of sbin. The -type command was used to specify the type of file to find, in this case it was a directory. The options available are:
File is of type c:
b block (buffered) special
c character (unbuffered) special
p named pipe (FIFO)
f regular file
l symbolic link (never true if the -L option or the -follow option is in effect, unless the
symbolic link is broken).
D door (Solaris)
The two most used are going to be the file and directory options. The next option used was the -name option, which can be used to specify the name or a part of a name to search for. You can use a wildcard to find variations, since the '-name bin' option will not find 'sbin' or 'bind', but '-name *bin*' will find all of them. Note that using the -regex option can be very complicated, so it is easier to use the '-name' option and possibly a wildcard or two.
While these few options are enough to get you started, they are nowhere near tapping the resources of this powerful command. I recommend exploring and using this command frequently, as it will make your CLI experience much more rewarding!