Linux – list only Directories

ls -lrt seems like a very powerful command for linux. But if you have a large number of files sitting in a directory with only a few sub-directories, it could be a pain to just list out the sub-directories. There is no list command in linux to list only directories. Therefore, the only way out is to list everything and use regular expression to filter only directories (starting with d)

ls -lrt | grep '^d'
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s