Search File Locations Use Ubuntu Terminal - Fosslicious

Tuesday, May 8, 2018

Search File Locations Use Ubuntu Terminal

This time I want to discuss about how to find a file via terminal. It is useful to shorten the time in searching the file. There are 2 tools that can be used, namely "find" and "locate". Between the two, the "find" command is easier to use. And this time I want to explain some simple commands that can be used in executing the "find" command.

Case: I want to find a file named godot.mp4, which is in the /Documents directory. First step, we must first move to the /Documents directory with this command. Open terminal(Ctrl+Alt+T) and type:
cd Documents
description: cd command used to change directory.

Next, I will try to find the godot.mp4 file with the -name parameter, with the command:
find -name godot.mp4
The result is like this:

File not found

No file found with the name godot.mp4. From this case, there are some things that cause the file not found:

1. Incorrect name and extension writing, or in that directory there is no file being searched.
2. The -name parameter is case-sensitve, so, this parameter differentiates between uppercase and lowercase.

For the first problem, it is a problem from the user. The second problem we can solve with the following command:
find -iname godot.mp4

The result is like this:

Search For File Locations Use The Ubuntu Terminal

This discussion is just a simple explanation of searching for files using the find command. If you want to explore from this command, you can see some parameters available at:

find --help