How To Search Folder In Linux Using Command

How To Search Folder In Linux Using Command

Introduction

Finding a folder is something very important in linux. basically we can do this in a very simple way on windows operating system as simple as clicking start button and search, but in linux operating system, there are some difference way to do a search, specially if we used terminal based search application in linux.

There are some packages that can be used to search folder in linux terminal for example : find and locate. Today i'm going to explain a bit explanation about how to search a folder in linux terminal using  "find".

What is Find package in Linux?

"FIND" is an application that run under linux operating system. this application is used to search  in custom directory tree by evaluate the given custom expresion.

Syntax to Search a Folder Using FIND

We need to understand the format syntax of find application before searching a folder using "FIND". Here is the syntax format :
find /location/to/search -name "folder_name_to_search"

Case Study and Implementation

Well, i will made up a case so you will understard how to use find better. The other day i've just create a directory named "report" that is located in "/home/user/Documents/report", today i forgot the location of my folder (directory) that i've created in yesterday, so all i need to do is to search the folder location, and that directory location can be found by using "find" command, here is the example of how to search folders named "report" using "find":
find /home/user -name "report"
here is the result:
user@asus:~$ find /home/user/ -name "report"
find: `/home/user/.cache/dconf': Permission denied
/home/user/Documents/report
find: `/home/user/.dbus': Permission denied
find: `/home/user/.config/enchant': Permission denied
find: `/home/user/.gvfs': Permission denied
we had a permission problem over here, all we need to do is to run  the command with super user access, so just put "sudo" before the command :
sudo find /home/user -name "report"
and here is the result:
sudo find /home/user/ -name "report"
[sudo] password for user:  *******
/home/user/Documents/report
based on the result, we have a new information that there is a folder name "report" that located in /home/user/Documents/report, now the forgotten directory can be accessed again.

Komentar

Postingan populer dari blog ini

Which television show centered around the lives of the Carrington family?

Donald Trump will be the first to serve two non-consecutive terms since which commander in chief?