7.8. Finding Files on Your Computer

Using Search for File from the Places menu, you can locate files on your computer using any number of search criteria. You can also open the Search for Files dialog by entering gnome-search-tool in a terminal window.

Figure 7.6. Search for Files Dialog

Search for Files Dialog

Search for Files uses the find, grep, and locate UNIX commands. All searches are case insensitive.

7.8.1. Performing a Basic Search

  1. Click Places+Search for Files.

  2. Type the search text in Name Contains. The search text can be a filename or partial filename, with or without wild cards, as shown in the following table:

    Search Text

    Example

    Result

    Full or partial filename

    myfile.txt

    Searches for all files that contain “myfile.txt” in the filename.

    Partial filename combined with wild cards (* [ ])

    *.[ch]

    Searches for all files that have a .c or .h extension.

  3. In Look in Folder, type the path to the directory in which to begin the search.

  4. Click Find.

Search for Files searches in the directory specified and any subdirectories of the directory and displays the results of the search in the Search Results list. If no files are found that match the search criteria, the application displays the message No files found in the list.

7.8.2. Adding Search Options

Use Show More Options to search by file content, dates, owner, or file size.

  1. Click Places+Search for Files.

  2. Type the search text in Name Contains.

  3. In Look in Folder, type the path to the directory in which to begin the search.

  4. Click Show More Options then click Available Options.

  5. Select a search option to apply then click Add. The following options are available:

    Option

    Description

    Contains the Text

    Searches for a file by filename. Type a full filename or a partial filename with wild cards in the field provided. Use an asterisk (*) to indicate any number characters. Use a question mark (?) to indicate a single character. The search is case sensitive.

    Date Modified Less Than

    Searches for files that were modified within the period specified (in days).

    Date Modified More Than

    Searches for files that were modified before the period specified (in days).

    Size At Least

    Searches for files that are equal to or larger than the size specified (in kilobytes).

    Size At Most

    Searches for files that are smaller than or equal to the size specified (in kilobytes).

    File is Empty

    Searches for empty files.

    Owned By User

    Searches for files that are owned by the user specified.

    Owned By Group

    Searches for files that are owned by the group specified.

    Owner is Unrecognized

    Searches for files that are owned by a user or group that is unknown to the system.

    Name Does Not Contain

    Searches for filenames that do not contain the string that you enter. Enter a full filename or a partial filename with wildcards in the field provided. Use an asterisk (*) to indicate any number of characters. Use a question mark (?) to indicate a single character. The search is case sensitive.

    Name Matches Regular Expression

    Searches for files that contain the specified regular expression in their directory path or filename. Regular expressions are special text strings used to describe a search pattern. For more information, see http://www.regular-expressions.info.

    Show Hidden and Backup Files

    Includes hidden and backup files in the search.

    Follow Symbolic Links

    Follows symbolic links when searching for files.

    Include Other Filesystems

    Searches in directories that are not in the same file system as the start directory.

  6. Specify the required search information for the search option.

  7. Repeat Step 5 and Step 6 for each search option to apply. To remove a search option from the current search, click the Remove button next to the option.

  8. Click Find.

7.8.3. Using the Search Results List

You can use the search results list to open or delete a file found during a search or save the search results to a file.

Figure 7.7. Search Results List

Search Results List

To open a file displayed in the list, right-click the file then click Open or double-click the file. To open the folder that contains a file displayed in the Search Results list, right-click the file then click Open Folder. To delete a file displayed in the Search Results list, right-click the file then click Move to Trash.

To save the results of the last search that Search for Files performed, right-click anywhere in the search results list then click Save Results As. Type a name for the file to which to save the results then click Save.

7.8.4. Disabling Quick Searches

By default, Search for Files tries to speed up some searches by using the locate command. locate provides a secure way to index and quickly search for files. Because locate relies on a file index, the results might not be up to date. To disable quick searches, run the following command in a terminal window:

gconftool-2 --type=bool --set /apps/gnome-search-tool/disable/quick/search 1

For more information about locate, see Section 10.1.4, “The Command locate” (↑Reference).