Trying to locate a file, how can I search the entire hard drive for a file?


9 Answers 9


A simple find / -type f -name "" would do the trick if you know exact filename.

find / -type f -iname "filename*" if you want to match more files (ignore case).

Make sure to properly delimit \ shell metacharacters in the filename like *?[] or replace them with a non-delimited *.

Avoid -type option if you want to search for directories etc. See manual of find for more information. To see the manual, issue the command:

man find

  • 2
    This will also search all mounted devices as well, might want to just search /mount/hddyouwanttosearch Dec 21, 2011 at 12:28
  • Worth noting that find is really slow, compared to an indexed search system, such as locate (but also more powerful)
    – tumbleweed
    Dec 23, 2011 at 6:30
  • 3
    note that one might wish to add sudo ahead of the mentioned command Sep 17, 2020 at 9:16

You could also use locate to look for commands. Why do people use locate if find does the job? Because locate is much faster than find since it just searches through database(s) of indexed locations to find your file/regex.


locate some-file.avi searches through database(s) of almost every file on the disk for a file called "some-file.avi".

locate -i "some-file.avi" will ignore the case of the file you are searching for.

locate -i "*.txt" will display a list of locations of all the files with **.txt* extension on your system.

man locate for more info on the file.

You might need to run updatedb first to ensure the index database is up to date, otherwise, 'locate' might not return what you are looking for.

  • Note that updatedb must be run as root. Dec 28, 2011 at 15:56
  • 6
    this is WAY faster than find \ holy cow... thanks! May 13, 2014 at 18:51
  • If updatedb adds / to the index by default, how can it still be faster than find /? Dec 12, 2018 at 16:11

Start by clicking the "Home Folder" icon in the launcher.

enter image description here

In the window that opens, click "Search".

enter image description here

Type what you want to search for in the box, then press enter. enter image description here

Under the dropdown for location, choose your hard drive, then click reload.

enter image description here

The results will then be displayed. Hope that helps!

  • 5
    The man who asked it states he uses a server, so there is no GUI. But that's a great answer anyway! Dec 28, 2011 at 15:57

If you're looking for a string inside a file, you can use grep. Here's a sample command:

grep -r -i "some string" /home/yourusername

This will find "some string" in /home/yourusername directory. The search will ignore case (-i) and recurse directories (-r). You can use / as the directory to search in the whole directory but that might not be very efficient.


On Ubuntu, i know that everyone wants to be dogmatic about using command line all the time, and I have in the past been that way, but I love the Gnome "Search for files..." tool. I think its awesome.

  • 4
    well i'm on a server
    – Blankman
    Dec 21, 2011 at 4:50
  • You should try then the KDE search. It is far better than the gnome one. I am still waiting for Nautilus to catch up with the versatility that the KDE search system has. Dolphin/Konqueror are far better because of it. Dec 21, 2011 at 4:53
  • Yeah, I was thinking about switching to Kubuntu actually. I'll take a look at it.
    – djangofan
    Dec 22, 2011 at 1:04

For a Desktop setup, Install "gnome-search-tool"
sudo apt-get install gnome-search-tool

Don't install this in a server, it will also install the ubuntu desktop package.
Thanks to @Rinzwind for pointing that out.

Filters inlude:

  1. Choose the folder you want to search. In this case \
  2. Contains the text - this is the file name.
  3. Date Modified - less or more than in number of days.
  4. File size - at least or at most a specified size. You can also search empty files.
  5. File owner - user, group or unrecognized owner.
  6. Regular expressions - matches regular expressions.
  7. You can choose to show hidden files, follow symbolic links or exclude other filesystems.

enter image description here

  • @Rinzwind The question was Trying to locate a file, how can I search the entire hard drive for a file? There is no 'server-install' anywhere...
    – Parto
    Feb 27, 2014 at 12:43
  • @Rinzwind Hahah. Nice one. Let me edit my answer and say this is for a desktop setup alone.
    – Parto
    Feb 27, 2014 at 12:50
  • 3 For a Desktop setup, Install "gnome-search-tool" sudo apt-get install gnome-search-tool sudo apt install gnome-search-tool Reading package lists... Done Building dependency tree... Done Reading state information... Done E: Unable to locate package gnome-search-tool ((((( it's now 2022 ))))))
    – aqk
    May 27, 2022 at 0:59

If you don't want to remember find (which is a very powerful) parameters you could install from official repos:

  • kfind - file search utility
  • gnome-search-tool - GNOME tool to search files
  • catfish - File searching tool which is configurable via the command line

The three of them are great, but I found kfind the best.

From Ubuntu Community help wiki you might find useful:

  • dpkg -L|--listfiles ... List files `owned' by package(s).
  • dpkg -S|--search ... Find package(s) owning file(s).

If need to find nested in some dirs:

find / -type f -wholename "*foo/bar/filename"

If you want to find a file or its contents, and you don't want the search to stop if your ssh session gets disconnected for some reason, and you want to store the results in a file that you can reference later:

$ sudo nohup find / -type f -exec grep -H -i -n mysearchstring '{}' \; -print 2>/dev/null | tee /home/rmoore/find_output.txt &

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .