Mastering file searches on Linux – Network World

There are many ways to search for files on Linux systems and the commands can be very easy or very specific — narrowing down your search criteria to find what just you’re looking for and nothing else. In today’s post, we’re going to examine some of the most useful commands and options for your file searches. We’re going to look into:

  • quick finds
  • more complex search criteria
  • combining conditions
  • reversing criteria
  • simple vs detailed responses
  • looking for duplicate files

There are actually several useful commands for searching for files. The find command may be the most obvious, but it’s not the only command or always the fastest way to find what you’re looking for.

Quick file search commands

The simplest commands for searching for files are probably which and locate. Both have some constraints that you should be aware of. The which command is only going to search through directories on your search path looking for files that are executable. It is generally used to identify commands. If you are curious about what command will be run when you type “which”, for example, you can use the command “which which” and it will point you to the executable.

$ which which

The which command will display the first executable that it finds with the name you supply (i.e., the one you would run if you use that command) and then stop.


Write a Reply or Comment:

Your email address will not be published.*