How To Find a Location of a Directory in Unix
Very quick tip for you today, I just see that many of visitors of this block are curious how they can find a directory in Unix – and so here’s a command to help you do just that.
Finding directories in Unix
There’s nothing better than to employ the find command. As you might remember, among many things, this wonderful tool allows you to search files by their type. Since nearly everything in Unix is a file, this means you can find directories.
Let’s take an example: if you wand to find out everything about your MySQL installation, you can have a search across your filesystems to find all the directories called mysql:
Here is how you would find a directory called mysql under /etc directory:
As you can see, there are quite a few directories which belong to MySQL, and you can see from the list that MySQL configuration is most likely to be in /etc/mysql directory.
Narrowing down directory search in Unix
If you search across all your filesystems, it may take too much time. That’s why it makes sense to narrow your search using common sense.
For example, if you’re looking for a configuration file of some standard package of software, most likely it will be under /etc directory, so you can specify it and greatly reduce the searching time.
In this example, we’re narrowing directory search to only those directories that are part of /etc:
See also
- Comparing text files in Unix
- How To Find the Largest Files in Your Unix
- Basic Unix Commands
- Unix find command
- Finding Large Files and Directories
- Find location of a Directory in Unix
- Listing directories in a directory
Very quick tip for you today, I just see that many of visitors of this block are curious how they can find a directory in Unix – and so here’s a command to help you do just that.
Finding directories in Unix
There’s nothing better than to employ the find command. As you might remember, among many things, this wonderful tool allows you to search files by their type. Since nearly everything in Unix is a file, this means you can find directories.
Let’s take an example: if you wand to find out everything about your MySQL installation, you can have a search across your filesystems to find all the directories called mysql:
Here is how you would find a directory called mysql under /etc directory:
As you can see, there are quite a few directories which belong to MySQL, and you can see from the list that MySQL configuration is most likely to be in /etc/mysql directory.
Narrowing down directory search in Unix
If you search across all your filesystems, it may take too much time. That’s why it makes sense to narrow your search using common sense.
For example, if you’re looking for a configuration file of some standard package of software, most likely it will be under /etc directory, so you can specify it and greatly reduce the searching time.
In this example, we’re narrowing directory search to only those directories that are part of /etc:
See also
- Comparing text files in Unix
- How To Find the Largest Files in Your Unix
- Basic Unix Commands
- Unix find command
- Finding Large Files and Directories
- Find location of a Directory in Unix
- Listing directories in a directory