Find

find finds. It finds! Very Simple. But you probably want to just use the search utility of your operating system. Also, in the terminal, it's much easier to use Locate, unless you're looking for a file that was created just now. But the search function that came with your operating system makes the most sense out of the three.

Relevant Usage at Saier Lab
Finding files when using the terminal. Always useful, but it's probably easier to use the search utility that comes with most operating systems, such as Windows or Mac. Also know that find can be unreasonably slow.

To find a file called "test.txt", you would type: find -name " " where is replaced by a folder name, including the angle brackets, and file is replaced by a file name, and the angle brackets are removed but the quotes remain.

To search the desktop for a file called file1, you would type: find /Users/saierlab/Desktop -name "file1" Or to search your current directory for a file called file1, you would type: find. -name "file1"

Asterisk
The asterisk can be used to denote "anything". If you can't remember if your file was called "file1.txt" or "file1.fasta", and it's on the Desktop, you can type: find /Users/saierlab/Desktop -name "file1.*" and it will find files that start with "test." and end with anything. The '*' denotes that anything can go here. Similarly, if you want to find all of your .phr files, you can run: find /Users/saierlab/Desktop -name "*.phr" and it will find all of the files that start with anything and end with ".phr". You can put the * anywhere, like "test*.txt".

Searching the Entire Computer
Stop reading now and use the built in search utility that came with your operating system. This method is incredibly slow and unwieldy. No seriously, don't even read the next sentence. Are you still here? Ok, well it better be out of curiosity then.

Everything file accessible on your computer from the terminal has a path that starts with the '/' character. This is not a stylistic choice, the '/' is the root directory, meaning you can take any file on your system, and if you keep continuously going to the parent directory of where you are, you will always end up in '/'. A file path may start with "~/", but don't be fooled, that's your home directory, "/Users/saierlab/". Your "~/" folder is in '/'.

All files are in '/', so to search all files, you search the '/' folder. If you're looking for file1.txt in the entire computer, type find / -name "file1.txt" 2>/dev/null the 2>/dev/null will reroute the error messages that you will get from trying to find files in folders you don't have permission to access.

Person to Ask

 * Bryant
 * Anyone