Searching for certain file names via SSH or command line: Locate and Find Commands

There are times when a server administrator needs to search along a path, or for that matter, the entire server for certain file names or file patterns.

Here is a useful command to conduct such searches via SSH on a standard Linux system.

I use this on Centos 5/6 frequently: In this example we are looking for a file called test.png

Using the locate command in SSH can do the same thing, only notice that it will grab instances of file names where the string searched for also appears – such as the conv_test.gif match.

Use these commands to serach your entire server, which obviously can take a while depending on your size, speed and the total number of files it needs to look through.

You can “find” more information and syntax examples here:

You can “locate” more information and syntax examples here:

Contact us today!

  • This field is for validation purposes and should be left unchanged.