- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Command to list/find ONLY all directories.
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 06:04 AM
02-15-2006 06:04 AM
But the following command shows all files & subdirectories, instead of showing only directories.
find . -type d -exec ll {} \;
OR
The next command just list a dot “.” Only.
/tmp#ll -ld
drwxrwxrwx 60 bin bin 7168 Feb 15 13:33 .
Thanks,
Gulam.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 06:06 AM
02-15-2006 06:06 AM
Re: Command to list/find ONLY all directories.
# find . -type d -exec ll -d {} \;
will do precisely what you require.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 06:07 AM
02-15-2006 06:07 AM
Re: Command to list/find ONLY all directories.
Just plain
find . -type d
works fine.
find . -type d -exec ll -d {} \;
Also works fine.
Why find??
ll -R . | grep ^dr
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 06:18 AM
02-15-2006 06:18 AM
Re: Command to list/find ONLY all directories.
I just would to list the all dir without recursive directories.
Thanks,
Gulam.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 06:20 AM
02-15-2006 06:20 AM
Re: Command to list/find ONLY all directories.
'find' is designed to descend a directory tree.
If all you want to see are directories immediately beneath a mountpoint (directory) or beneath another directory, do:
# ls -l /tmp | grep "^d"
The caret (^) anchors the grep to the beginning of the line. Sice 'ls' reports directories with a leading "d", the above command should give you what you want.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 06:22 AM
02-15-2006 06:22 AM
Re: Command to list/find ONLY all directories.
58
/tmp#ll -R . | grep -c ^dr
201
tmp#find . -type d -exec ll -d {} \;|wc -l
202
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 06:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 06:52 AM
02-15-2006 06:52 AM
Re: Command to list/find ONLY all directories.
Find everything on the system then pipe it through grep and listing only directories. Using the ^ character as an anchor.
The resulting list will be directories only with full list as supplied by the 'ls -la' command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:10 PM
02-15-2006 08:10 PM
Re: Command to list/find ONLY all directories.
ls -l|grep ^d
HTH,
Art
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:14 PM
02-15-2006 08:14 PM
Re: Command to list/find ONLY all directories.
# ls -l . | grep -E '^d'
That is it.
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:18 PM
02-15-2006 08:18 PM
Re: Command to list/find ONLY all directories.
# cd
# find . ! -name "." -type d -prune
--
Muthu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:23 PM
02-15-2006 08:23 PM
Re: Command to list/find ONLY all directories.
A small script will do,
for i in * ; do if [ -d $i ]; then echo $i ; fi ; done
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-15-2006 08:49 PM
02-15-2006 08:49 PM
Re: Command to list/find ONLY all directories.
will miss .
Try to use as,
for i in `ls` ; do if [ -d $i ]; then echo $i ; fi ; done
--
Muthu