Ubuntu

Finding Files in Ubuntu 20.04

As Ubuntu is currently the most popular opensource operating system, the release of Ubuntu 20.04, an LTS (Long Term Support) version, has garnered a lot of popularity in the Linux community. The new LTS version appears to have changed quite a bit, in terms of visual design and performance, from the older 18.04 LTS version. Ubuntu 20.04 introduces an entirely new theme, divided three different variants – Light, Dark and Standard – each of which appears to give a modern, minimalist vibe.

This version also supports GNOME 3.36, which uses fewer resources and is sleeker. This has brought forward a new wallpaper, a redesigned lock screen, and the ability of the user to group together different applications inside a single folder. Another major change has appeared in the search feature, which has now become powerful enough for more in-depth searching.

In this article, we will be looking at some of the ways that users can search and find files on the latest Ubuntu 20.04 release.

Finding Files Using Graphical User Interface (GUI)

Unlike older versions, in which the GUI search feature was less accurate and efficient than the terminal search commands, Ubuntu 20.04 has greatly improved this feature. Now, the search screen differentiates between different search sources more cleanly, helping you find the app, file, or setting you require much more quickly.

To begin searching for files, click on Activities. You will see a search bar at the top of the screen.

Image 1:

Image 2:

Enter the name of the app, file, or settings, or some keyword relating to what you are trying to find.

For example, say, we search for the term “them.” The result we would get is as follows:

From the image above, we can clearly see the search feature differentiating its results into distinct categories.

If you want to narrow down your search results, open Settings and select the Settings options.

From here, you can choose to switch a specific search category on and off, and even move them up and down in terms of which takes more preference in the results list.

If you are only interested in searching for files, then a better method would be to search from inside the directory. To do this, first open the Files application under the Activities bar.

If you know the file that you are trying to search is present in some specific folder, then go to that folder.

Click on the search icon present in the menu bar next to the toggle view icon

By clicking on the downward arrow button, a filter menu will appear from which you can further narrow your results, as shown in the image below:

With the When filter, you can filter the results temporally by selecting how far back in time you wish to go for the search process. The search can also be filtered by either the last used option or the last modified option.

The What filter allows users to specify the type of the file that you wish to search for.

The search filter even allows users to categorize whether they want to search not only the names of the files but also the contents.

Finding Files Using the Command Line

For users wanting to stick to the command line, there are two ways for searching and finding files with the terminal

a) The Find Command

The find command is a flexible and useful command, as it allows users to search for files based on specific set of conditions such as by date, file size, etc.

Users can search for files using the following syntax:

$ find /path/ -iname nameOfFile

To find a specific file by name, enter the following command into the terminal:

$ sudo find . -iname nameOfFile

For example, say, I want to search for a file with the name sample.py. This can be done by using the following command:

$ sudo find . -iname sample.py

Users can also search using some content that could be inside the file that the user is looking for. This comes in handy when the user cannot seem to remember the file name. This can be done simply by entering the following command:

$ sudo find . -name "*content*"

If I wanted to search for all files containing the keyword “hello,” for example, then the output I would get is:

To search files based on date, there are three different options:

$ sudo find . -mtime -days

This refers to any file that was modified within fewer than the specified number of days.

$ sudo find . -atime -days

This refers to any file that was accessed within fewer than the specified number of days.

$ sudo find . -ctime -days

This here refers to any file that was changed within fewer than the specified number of days.

For example, I want a file that was changed within the past two days. The command for this would be:

$ sudo find . -ctime -2

b) The Locate Command

Another command that can be used to find files is the Locate command. Although this command has less features than the Find command, Locate makes up for it by being much faster and more efficient.

Searching for files is relatively easy with the Locate command. This command can be executed simply by running the following command:

$ locate -i nameOfFile

If I wanted to find all files with the name sample.py, then I would enter the following command into the terminal:

$ locate -i sample.py

Users may also use the Locate command to search for multiple files. This can be done using the following command:

$ locate -i nameOfFile1 nameOfFile2

The following image shows an example of this situation. I am trying to find all files with the name sample.py and hello.py:

Has Finding Files in Ubuntu 20.04 Become Easier?

Ubuntu 20.04 has greatly improved some of the features of its former version and even added some new and exciting features. One of the most innovative features is the search feature, which has become much more powerful and more efficient than its predecessor version. Users which found the Command Line difficult to maneuver can now use the Graphical Search Interface which has resulted in much a more efficient searching function than the search terminal commands.

About the author

Karim Buzdar

Karim Buzdar holds a degree in telecommunication engineering and holds several sysadmin certifications. As an IT engineer and technical author, he writes for various web sites. He blogs at LinuxWays.