Searching for Files with KDE

KDE has a very powerful graphical search feature that can locate files by name, their contents, or even their properties such as date of creation, file size, owner and combinations of those attributes. Launch the file finder by accessing the KDE menu launcher and then the top level of the Applications menu as shown in Figure 1, below.

Launching the KDE File Finder

Figure 1: Launching the KDE File Finder

You can add the Find Files icon, a pair of binoculars, to the tool bar. Just right click on the icon in the launcher and select Add to Favorites.

Searching for Files By Name

When first opened, the KDE search tool defaults to the Name/Location tab. To locate files, type in the name of the file you are searching for and click on the Find button.

In Figure 2 I am trying to locate the file LinuxClasses.tar. I know the file name but I do not remember where I stored it.

Figure 20: Finding a single file when you know its name.

Figure 2: Finding a single file when you know its name.

Figure 2 shows the results of a simple search. In this search the Named field contains the name of the file I want to find; this is the search string. Note that the Look in field contains the folder in which I want the search to begin, in this case, my home directory. I could use the Browse button next to the Look in field to select a different folder in which to search.

Generally starting in your home folder (directory) is the appropriate place to start searching for files. The search will start in the specified folder and continue in all folders contained in your home folder. The search will continue into each subfolder until every folder in your home folder has been searched.

This search was done case insensitive so that I could enter the file name in all lowercase. The search will find file names with both upper and lowercase names, like Linuxclasses.tar, Linuxclasses.tar, LINUXCLASSES.TAR, linuxclasses.tar and so on, with any combination of upper and lowercase. If the Case sensitive search box is checked, the search will only locate and display the file named with the exact name including the correct case. So entering linuxclasses.tar will not find LinuxClasses.tar; it would only find linuxclasses.tar.

Using Wildcards in Searches

If I type in the exact and complete name of a file the KDE search tool will have no trouble finding it so long as it exists. However I may not know the complete or exact name of the file for which I am searching. This is when I need to be able to search more generally for a partial file name.

Figure 21: The Dolphin search tool allows you to find files and folders by name.

Figure 3: Find multiple files and folders by name using wildcard characters.

Suppose that I want to locate a folder that contains information about Linux classes that I teach. For the purposes of this example, I do not recall whether I called the folder “LinuxClasses” or LinuxCourses” or something else entirely. I do recall that it starts with “LinuxC”. So that is what I type into the Named field of the KDE search tool — except that I add the * wildcard character.

In Figure 3 I have used the * wildcard to search for all files  and folders beginning with the charcters “linuxc”. The * wildcard is also known as “splat,” “star,” or “asterisk”. This wildcard at the end of the character string “LinuxC” means very specificallly, “Find all files with names that begin with “LinuxC” and end with zero or any other combination of characters of any length.

In Figure 3, the search string “LinuxC*” finds two files and one folder. The LinuxCourses folder is the folder for which I am looking.

The other wildcard character is the question mark “?”. It means “exactly one character,” so that a search string of “myfile?” would find files named myfiles, myfile2 and myfiled, but not myfile, yourfile, myfiles2 or myfileaboutsomething.

Wildcards can be used anywhere in a search string, the beginning, middle and end. You can also use multiple wildcards in the search string.

Searching for Files by Content

Assume that I do not remember the name of the file for which I am looking, but I do remember that it has one or more fairly unique words or phrases that can help me to identify it. In this case I can use the Contents tab of the KDE file search tool. I also know that the file is an OpenDocument presentation.

One problem with searching the contents of files is that each file has to be opened and the contents searched for the specific word or phrase you have entered. This can take a great deal of time. You can speed up the search by narrowing the criteria. For example you may select a specific file type to be searched and all other file types will be ignored. Use the File type drop-down selector to specify the desired file type.

Figure 22: Narrow down the search by selecting one or more filetypes to search. The search program ignores the types not selected.

Figure 4: Narrow down the search by selecting one or more filetypes to search. The search program ignores the types not selected.

Figure 4, above, shows the results of searching for an OpenDocument presentation (similar to Power Point presentations) and searching for the text “kernel” contained within the presentation. This gives me a list of all OpenDocument presentations that contain the word “kernel”. In this case, my search found 3 documents matching my criteria.

If you do not enter any text to use in narrowing down the search, you can use this to locate all files of a particular type, such as Word documents or ODF (Open Document Format) documents. For example, you might wish to find all of your photos in order to create a CD to send to family.

Searching by Properties

I can also locate files by their properties, such as size, the date the file was created or last modified, and several others. This gives me a good way to clean out older files that might no longer be needed.

Figure 23: Using the Properties tab to locate older files that I might want to delete or archive.

Figure 5: Using the Properties tab to locate older files that I might want to delete or archive.

In Figure 5, I have done a search in my Documents directory for all files that were created between January 1, 2001 and December 31, 2005. My search found 996 files so I might want to narrow my criteria further, perhaps narrowing the date range or selecting specific file types.

You can also easily locate files that were created within the past X number of hours, days or years. If you share folders with other users, you can search files by ownership.

Combining Search Criteria

You can combine criteria on different tabs. So you can specify a starting folder for your search on the Name/Location tab and a file type along with some text you expect to be found in the contents of the file on the Contents tab.

What now?

After locating the file or files for which you are searching you now need to do something with them. Simply right click on one of the files to open a context menu that gives you the options for that file. For most files you will be able to move, copy or delete them. You can also open them with one of one or more applications in the Open with menu item. You can also choose from among other options such as moving to Trash or encrypting the file.

The KDE search tool is very powerful and allows you to find files using a number of different criteria in various combinations in order to narrow down the search and minimize the number of files in the results. It is  not uncommon to lose a file or forget where you put it. The search tool can help with that. It can also help when you need to locate old files, files with specific content and certain types of files.