How to find a folder in Linux using the command line

I am a new Linux user. How do I find files and folders in Linux using the bash command line? What is the command to find a folder in Linux?

You can use find and locate commands in Linux to find folders and files from the command line. This page shows how to search for folders in Linux using various command line utilities.

Command to find a folder in Linux

  1. find command – Search for files and folder in a directory hierarchy
  2. locate command – Find files and folders by name using prebuilt database/index

How to find folder on Linux using find command

The syntax is:
find /where/to/look/up/ criteria action
find /folder/path/to/look/up/ criteria action
find /folder/path/ -name "folder-name-here"
find /search/path/ -name "folder-name-here" -print
find /search/path/ -name "folder-name-here" -ls
find /folder/ -name "pattern"

Finding a folder named Documents

To find a folder named “Documents” in your home directory ($HOME i.e. /home/vivek/ home directory), run:
find $HOME -type d -name "Documents"
find ~ -type d -name "Documents"
find /home/vivek/ -type d -name "Documents"

find command in action on Linux

How to search for case incentive folder names

You can force find command interpret upper and lowercase letters as being the same. For example match Documents, DOCUMENTS, DocuMEnts and so on by passing the -iname option:
find $HOME -type d -iname "Documents"
find ~ -type d -iname "Documents"
find /home/vivek/ -type d -iname "Documents"
Sample outputs:


How to search a folder named /etc/ in the root (/) file system

When searching / (root) file system, you need to run the find command as root user:
# find / -type d -name "etc"
$ sudo find / -type d -name "etc"
$ sudo find / -type d -iname "etc"

How to hide “Permission denied error messages” when using find command

The find will show an error message for each directory/file on which you don’t have read permission. To avoid those messages, append 2>/dev/null at the end of each find command:
$ find /where/to/look/ criteria action 2>/dev/null
$ sudo find / -type d -iname "etc" 2>/dev/null

How do I find a directory called python.projects?

find / -type d -iname "python.projects" -ls
find / -type d -name "python.projects" -ls
It is also possible to use the bash shell wild cards, run:
find / -type d -name "python.*"
sudo find / -type d -name "?ython.*"

Understanding find command options

  • -name : Base of file name (the path with the leading directories removed) matches shell pattern.
  • -iname : Perform a case insensitive search for given pattern
  • -print : Print the full file name on the standard output (usually screen), followed by a newline.
  • -ls : Display current file in ls -dils format on standard output i.e. your screen.
  • -type d : Only list folders or directories.
  • -type f : Only list files.

Search folder in Linux using locate command

To search for a folder named exactly dir1 (not *dir1*), type:
$ locate -b '\dir1'
$ locate -b '\folder2'

Just search for file name matching Pictures, type:
$ locate Pictures
For more info see “UNIX Find A File Command“.


In this tutorial, you learned how to find a folder on the Linux system using find and locate commands. For more info see gnu find command help page here.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

Comments on this entry are closed.

Comments are closed. Still have questions? Post it on our forum