UNIX vdir Only Directories

by on February 20, 2007 · 0 comments· LAST UPDATED February 20, 2010

in

How do I vdir only directories under UNIX / Linux operating systems?

The vdir command is equivalent to ls -l -b command; that is, by default files are listed in long format and special characters are represented by backslash escape sequences.

vdir example

Type the following command
vdir
Sample outputs:

total 44
-rw-r--r-- 1 vivek vivek    0 2010-02-20 15:34 --bar.txt
drwx------ 2 vivek vivek 4096 2010-02-20 13:23 flashgot.0xjjfk2r.default
-rw-r--r-- 1 vivek vivek    0 2010-02-20 15:37 foo
-rw-r--r-- 1 vivek vivek    0 2010-02-20 15:34 -foo.txt
srwxr-xr-x 1 vivek vivek    0 2010-02-20 14:40 gedit.vivek.1838848260
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 gpg-hbhf4I
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 keyring-pZ5OTj
drwx------ 2 gdm   gdm   4096 2010-02-20 10:50 orbit-gdm
drwx------ 2 vivek vivek 4096 2010-02-20 15:00 orbit-vivek
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 pulse-fUTnhREF506W
drwx------ 2 gdm   gdm   4096 2010-02-20 10:50 pulse-PKdhtXMmr18n
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 ssh-ZYKkLP2579
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 virtual-vivek.2eyOdr
drwxrwxrwt 2 root  root  4096 2010-02-20 10:49 VMwareDnD
drwx------ 2 root  root  4096 2010-02-20 10:49 vmware-root

To vdir only dirs and nothing else use the grep command in pipe (filter) mode:

vdir | grep '^d'

Sample outputs:

drwx------ 2 vivek vivek 4096 2010-02-20 13:23 flashgot.0xjjfk2r.default
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 gpg-hbhf4I
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 keyring-pZ5OTj
drwx------ 2 gdm   gdm   4096 2010-02-20 10:50 orbit-gdm
drwx------ 2 vivek vivek 4096 2010-02-20 15:00 orbit-vivek
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 pulse-fUTnhREF506W
drwx------ 2 gdm   gdm   4096 2010-02-20 10:50 pulse-PKdhtXMmr18n
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 ssh-ZYKkLP2579
drwx------ 2 vivek vivek 4096 2010-02-20 10:50 virtual-vivek.2eyOdr
drwxrwxrwt 2 root  root  4096 2010-02-20 10:49 VMwareDnD
drwx------ 2 root  root  4096 2010-02-20 10:49 vmware-root
TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 0 comments… add one now }

Leave a Comment

Tagged as: , , , , , , , , , , , , ,

Previous Faq:

Next Faq: