Great how-to from www.omgubuntu.co.uk
| Unfortunately in Linux, certainly Ubuntu, the default GUI file search is not the most useful way to find files.
With just a small amount of patience you can find files quickly and easily using the command line, and your options for this are really powerful if you want to learn a bit about it. LocateThe easy, quick command is called “locate”. To use this command at the terminal you simply type: $ locate -i searchstring This will search for all files and directories with “searchstring” in the name, and The results are instantaneous because the system has created a database (also known as an index) to tell you where files are located. The only problem is that newly created or moved files may not be found correctly until the next database update, and you don’t have many options to choose from for your search. Forcing locate to update the database/index is done with Example: $ locate -i omgubuntu.desktop FindThere is a much more powerful command available to you called “find”. You can tell “find” where to look, what criteria to use in its search, and what actions to take once you have found what you are looking for. The syntax for “find” is: $ find <where to start searching> <search criteria> <actions to take> If you don’t add any parameters, find will default to searching the current working directory (or “ Two examples: $ sudo find / -type f -mmin -10 This example will find (starting at the root directory, or /, and recursively search subdirectories) all normal files ( This would be useful if you know you edited a file recently but don’t know where you put it, or have to find a log file for a program that crashed. You can add sudo here because find does not search files/directories that the current user does not have permissions for, and it will return error messages if you aren’t a sudoer — just be careful! $ find ~ -iname "*new*" -exec mv -v {} /media/current-projects/ \;
This will find everything in your home directory (~) with a name, case insensitive (-iname), containing new (“*new*”) and execute (-exec) a move (mv) of the results ({}) to /media/current-projects/ ( \; is required by -exec to show the end of the command to be executed). So all your files will be moved to the same place. mv -v displays the results of the move command with (-v)erbose messages. Another warning with -exec, though it is powerful, when used without care you can overwrite your whole home directory or whole disk – so be careful! Catfish is a GUI OptionFor those of you who simply can’t do without a GUI, you can find the program Catfish in the repositories — this enables you to run both Think of Catfish as an equivalent to Windows Search. If you want the full power of find, you’ll need to run it from the command line, using the quick tips above. |