Find

Find looks for a file within specified directories.  It can search multiple directories simultaneously.

Ex:
find /Users/bwarner ./sample /var/log -type f -name “*.log”

You can also search for files with other properties (like permissions):

find /Applications -type f -perm 0664

Finding files modified in a range of time:

find / -atime 2 (this will find all files modified in the last 2 days)

find / -mtime +1 -mtime -2 (this shows all files modified between 1 and 2 days ago)

find / -cmin -60 (shows all files modified in the last 60min)

Find is a slow process.

Locate

Locate is a much faster result than find.  It is based on a database of file location data.  This is useful only if you keep this database updated (i.e. sudo updatedb.)

Whatis

Whatis tells the user a summary of a command’s function:

whatis ls 

ls(1)                    – list directory contents

 

Whereis

Whereis will locate a binary, source or man pages of a Linux command.

Ex:

whereis ls

/bin/ls

Which

Which locates commands as well. With which, you can send in more than one parameter, i.e.:

which ls grep top

 

Leave a Reply

Your email address will not be published. Required fields are marked *