This article demonstrates the following methods to find files on Ubuntu 22.04.
– How to find files using Graphical User Interface (GUI)
– How to find files using terminal
How to find files in Ubuntu 22.04 using the GUI
The graphical user interface can also be an effective tool to find files on Ubuntu 22.04. We have provided a sequence of steps to find various files on Ubuntu 22.04.
Step 1: Click on the “Activities” placed on the menu bar.
The following interface will appear.
Step 2: We typed “linux” in the search bar and the result shows the file names and paths that contain “linux” in their names.
By this way, you can easily trace the files alongside their paths.
How to find files in Ubuntu 22.04 using terminal
Terminal acts as a mandatory utility for Linux users. The terminal can be used to find the files in Ubuntu 22.04. Here, we would list various commands that help in finding files on Ubuntu 22.04.
How to use the ‘locate’ command to find files in Ubuntu 22.04
The locate command can also be used to get the path of your file. The locate command accesses the “mlocate.db” file only. The “mlocate.db” file contains the path of the files on your system. The locate command does not search inside your local drive. It searches for the name inside the “mlocate.db” file and displays the path(s) of the file on the console.
Syntax
The syntax of the locate command is provided below:
The <file1>, <file2>, and <file3> represent the names of the files that you want to search. Moreover, it supports multiple options that serve various purposes. The following command prints the options supported by the locate command.
The output shows various options of the locate command alongside their usage.
Example
The below-mentioned locate command shows paths of all files that have “linuxhint” in their names.
You can trace the files using the wild card as well. For instance, the following locate command will list down the paths of files ending with the “.txt” extension.
The output lists down the paths of the files that have “.txt” in their names.
How to use the ‘find’ command to find files in Ubuntu 22.04
The find command can be used to trace any file saved on your Ubuntu 22.04 system. The find command searches the file name inside the local hard drive. However, it returns effective and accurate results when you do not know the exact name of the file. It can be concluded that the find command produces more effective results than the locate command. However, the locate command is faster than the find command.
Syntax
Generally, the following syntax is used to exercise the find command on Ubuntu 22.04.
The [path] tells the find command to trace the files in the specific directory. The [expression] plays a key role in searching the files with some specific options and functionalities such as by name, by size, etc.
How to find a file by name in Ubuntu 22.04
The find command supports the name//iname option to search the file by its name (sensitive/insensitive). The name option refers to case-sensitive and the iname relates to insensitive searching of names. The following command will determine which files contain the name linuxhint.txt
The output shows that the file is placed on the desktop.
How to find a file by size in Ubuntu 22.04
The size option of the find command can trace down the files with respect to their sizes. For instance, the below-mentioned command will look for the files in the current directory that have a size greater than 10MB.
The (.) states that searching will be performed inside the current directory and its sub-directories.
From the output, it is observed that there are only two files that have size greater than 10MB.
How to find a file by time/date in Ubuntu 22.04
The find command allows you to get the files according to their access time, modification time, and change time.
The “-atime” option refers to the access time and it accepts positive/negative integer values. The command provided below traces the files that were accessed 3-days ago.
The “-mtime” option refers to the modification time. We have executed the command to get the files that were modified more than a day ago.
Similarly, the “ctime” refers to the files whose properties were changed. The following command finds the files inside the “./Desktop” directory whose content was changed less than 1-day ago.
Here you go!
You would have learned to find files using GUI and CLI.
Conclusion
The files can be found on Ubuntu with the help of the command-line and graphical interface on Ubuntu 22.04. The find and locate are the widely used commands to find files on Ubuntu 22.04. The find command searches for the files inside the local storage drive whereas the locate command looks for files inside the “mlocate.db” file. This post has provided the detailed usage of these commands and the graphical interface to find the files on Ubuntu 22.04.