How to Use the Unix Find Command
The Unix find command, as the name implies, is a command that you can enter into the command line, or terminal, of a Unix operating system, allowing you to process any given set of files or directories. It is a highly useful command that you can take advantage of on Unix based operating system, making it a valuable tool in a lot of situations.
Using the find command on Unix allows for a multitude of possibilities. The Unix find command can take advantage of many parameters to help you make your search as wide or as narrow as possible. Some examples of the parameters that you can specify are: where to search, the file’s type that you are looking for, what you want to do with the file once it has been found, the actual name of the file, and any logical operators (such as “and” and “or”) that may help expedite your search process.
The commands for each of the above parameters are as follows: pathname is used to define the folders you wish to search in, -type is used to define the file type, -exec is used to show what to do with a file, -name is the name of the file, -a is logical operator “and”, and -o denotes logical operator “or”.
Using the find command is as simple as typing the word “find” into your terminal, followed by whatever parameters you choose. Below is a sample search using the Unix find command when looking for a particular name of a file.
find . -name “filename.mp3″ -print
This command will find the file you are looking for, filename in this case, and print its location on your screen.
A more advanced use of the Unix find command will be much longer and more complex in its code. Below is an example of a much more advanced search.
find /music/oursongs -not ( -name “yoursong.mp3″ -o -name “mysong.mp3″ ) ‘{}’ ; -print
This command will allow you to find a file in the music/oursongs directory that does not include the filenames yoursong.mp3 or mysong.mp3. It will then display all of the found files and their locations on the screen.
- How to find a Unix command
Unix provides hundreds of useful commands for all sorts of purposes, but it is sometimes difficult to find the specific command you are looking for. To assist you with this task, most versions of Unix provide the `man -k` command. The `man -k` command searches the online manual pages to help you find the Unix [...]...
- How to Use the Unix Grep Command
The Unix grep command is a search command built into a variety of Unix based operating systems. This command line utility, whose name stems from the original Unix term which means “search globally for lines matching the regular expression, and print them,” can be accessed using the command line or terminal from anywhere in the [...]...
- How to Use the Unix Sort Command
The Unix sort command is a command for the Unix family of operating systems. It is designed to sort whatever information you give it. The command can be used for a variety of purposes, but it is most frequently employed when there are a number of different files which need to be ordered in some [...]...
- How to Find Out CPU Utilization in UNIX
Keeping track of your CPU’s performance is extremely important. In UNIX, you can accomplish this task by using the system utilities and commands. For those who would like to find out their CPU utilization, one command is extremely important. It is called SAR – System Activity Reporter. The SAR commands make accessing CPU performance quite [...]...
- Where to Find a Unix Tutorial
Unix has many dedicated fans who have written quite a few excellent Unix tutorials for beginning users. Here are a few of the better Unix tutorials: Unix Tutorial for Beginners Unix: The Bare Minimum Introduction to Unix commands Unix Tutorial UNIXhelp for Users Unix Tutorial and Command Reference Unix Tutorial...




