To list only subdirectories within a directory, you can use the following command:
find /path/to/directory -type d -maxdepth 1
- Replace
/path/to/directorywith the path of the directory you want to check. - The
-type doption specifies that you want to find directories. - The
-maxdepth 1option limits the search to the immediate subdirectories, preventing it from listing deeper levels.
Alternatively, you can use:
ls -d /path/to/directory/*/
This command will also list only the subdirectories within the specified directory.
