Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to search for a directory from the terminal in ubuntu

I am using Ubuntu and I want to search for a specific Directory called "sdk".

All that I know is, that "sdk" Directory is located somewhere under /user Directory

how can I search for "sdk" Directory from the terminal?

I tried the following find / -name example docs -type d

but it says no such file or Directory.

like image 647
LetsamrIt Avatar asked Dec 19 '17 12:12

LetsamrIt


People also ask

How do I find the directory in Ubuntu terminal?

To use this command, type “pwd” into your terminal and press enter. This command will print the current working directory. The output will be the file path.

How do I find the directory of a file in terminal?

To see them in the terminal, you use the "ls" command, which is used to list files and directories. So, when I type "ls" and press "Enter" we see the same folders that we do in the Finder window.

How do I go to a specific directory in Linux terminal?

Navigate directories. Open a window, double-click on a folder, and then double-click on a sub-folder. Use the Back button to backtrack. The cd (change directory) command moves you into a different directory.


2 Answers

you can search for directory by using find with flag -name

you should use

find /user -name "sdk" -type d

meaning find directories named sdk in or below the directory /user

or if you want to be case-insensitive

find /user -iname "sdk" -type d
like image 178
recycler Avatar answered Oct 07 '22 04:10

recycler


Please try the below command.

locate foldername | grep /foldername$
like image 35
Swapan Shaw Avatar answered Oct 07 '22 06:10

Swapan Shaw