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.
Examples:
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.
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.
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:
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).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
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.Examples:
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.Start by clicking the "Home Folder" icon in the launcher.
In the window that opens, click "Search".
Type what you want to search for in the box, then press enter.
Under the dropdown for location, choose your hard drive, then click reload.
The results will then be displayed. Hope that helps!
If you're looking for a string inside a file, you can use grep. Here's a sample command:
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.
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:
\
If you don't want to remember
find
(which is a very powerful) parameters you could install from official repos:The three of them are great, but I found kfind the best.
From Ubuntu Community help wiki you might find useful:
If need to find nested in some dirs:
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: