Thursday, February 22, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  3] [ 0]  / answers: 1 / hits: 10735  / 1 Year ago, tue, january 24, 2023, 9:00:26

Files & Folders Lens can be used to locate user's documents easily, but it seems ignoring system files and folders.

How can I search & locate system files and folders?

(Say for example I want to locate a folder named .metadata, which contains some settings of my Eclipse IDE, and I know that this folder is there in the file system somewhere but I don't know where)

I use 12.04 LTS

More From » 12.04


You can use the find command to find folders with the -type d parameter. Here are a few examples:

#Search Root ( / ) folder for a folder called www

nits@excalibur:~$ sudo find / -name www -type d

#Search current folder for a folder which start either Capital/lower-case M

nits@excalibur:~$ find . -iname m* -type d
./.cache/chromium/Default/Media Cache

In the above examples, you would have noticed that only the directories with no subdirectories in them are listed. You can use mindepth/maxdepth to set the depth of the level that needs to be traversed.

#Search current directory for directories starting with either capital/lower-case M but only are present in the current directory

nits@excalibur:~$ find . -maxdepth 1 -iname m* -type d

# Traverse two levels (current level and one level under) in the current directory for directories starting with either capital/lower-case M:

nits@excalibur:~$ find . -maxdepth 2 -iname m* -type d

There are a whole load of different options to search directories and files as well using find, you can look through the man-page accessible by man find for all the options and how to use it. Also although find is slower than locate it doesn't require updatedb to update a DB to search through because the search is performed real-time.

[#36978] Thursday, January 26, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 402
Total Questions: 125
Total Answers: 98

Location: Jersey
Member since Sun, Dec 4, 2022
1 Year ago