How to search a directory in linux by its name

You can use the terminal’s find command.

  • The -type d option allows you to search directories
  • The -name “directory_name” option allows you to search by the name of the file or directory

For example, if you wanted to find the path where the “wp-content” folder is located within a Linux server, to see where WordPress is installed, you could run the following command.

find / -type d -name “wp-content”

If you wanted to search in a particular directory, for example so that it only searches inside the “var” folder, you could indicate it in the path like this:

find /var -type d -name “wp-content”

Once the command is launched, it will respond with the complete absolute path where that directory is. Or if there are several, it will show you several routes in the results of the execution of the command. That is all!

See also  Importance of documentation
Loading Facebook Comments ...
Loading Disqus Comments ...