- 1 How to find files in Ubuntu Linux with Locate and Find command?
- 2 What is the “Locate” command?
- 3 What is the “Find” command?
Ubuntu Linux has a terminal to access the system without using the graphical interface. For this reason, it is advisable to learn to use the terminal and certain basic commands. If you want to search for files, you may be wondering How to find files in Ubuntu Linux with Locate and Find command?, with this article you will learn how to do it.
How to find files in Ubuntu Linux with Locate and Find command?
Ubuntu Linux is an operating system created by the community and is free to use, that is, you do not have to pay to have the License. You can use this system at home, an educational institution, or any business. Ubuntu Linux guarantees security of your users through regular updates with server and desktop versions.
Next, we present relevant aspects about the Locate and Find commands and how you should use them in order to locate files from the Ubuntu Linux terminal.
What is the Ubuntu terminal?
The Ubuntu terminal is a command interpreter used to access the operating system through specific commands that the user enters. In this way, it is possible to perform different actions such as renaming files with the command line or searching for them quickly and efficiently.
Procedure to search for files in Ubuntu Linux with Locate and Find command
If you have the Ubuntu Linux operating system and want to search for files, you must learn to handle the Locate and Find commands as explained in the following procedure.
What is the “Locate” command?
The command “Locate” It is an essential resource for searching files because it is very fast and useful. “Locate” works by searching through the database file mlocate.db which contains all the file paths on the system.
To use the “Locate” command you must install it since it is not common to find it in the system Ubuntu Linux. Press the keys “Ctrl + Alt + T” and type sudo apt install locate in the terminal in order to proceed with the installation process of this resource.
You may also be interested in:
Prepare the “Locate” command
In the same way that it is possible to install programs in Ubuntu Linux from the terminal, it is necessary to install “Locate” on the computer. To achieve this, access the terminal again and type sudo updatedb. In this way, you will be able to update the database corresponding to the “Locate” resource.
Use the “Locate” command
To use the Locate command, go to the Ubuntu terminal with the keys “Ctrl + Alt + T”. There, type the command followed by the name of the file you want to find: locate filename.
Enter the manual to learn more about the Locate command
You can find more information about this command by typing in the terminal the command locate –h. With this line you will get relevant information that will help you make the most of this resource. Also, you can access the manual by typing: man locate.
What is the “Find” command?
The “Find” command is a more powerful search facility than “Locate” but slower. This occurs because “Find” performs the searches directly on the hard drive to find files and folders. “Find” is ideal when you want to find a file for which you cannot remember its precise name.
How does the Find command work to find files in Ubuntu?
The Find command searches for files that belong to a specific group of users, those files that were modified, hidden files and of a specific size.
Use the Find command to search for files in a specific directory
If you know the exact location of the file you want to find, then enter the terminal with the combination “Ctrl + Alt + T”. In the terminal, type the command find. –Name “* filename *”. The period (.) Refers to the “current directory”.
However, if you want to search the “home directory” you must replace the period (.) With (~ /) and if you are going to search the entire file system use (/).
You may also be interested in:
Search for files on Ubuntu Linux with a specific size
If you want to get a file but only remember its size, you can type the command find. –Size -4M this line means that the resource will search for files less than 4 Mb in size.
I'm sorry this content was not useful for you!
Let me improve this content!
Tell me, how can I improve this content?