The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
HD Controller does not Work in Solaris ciscocbee Filesystems, Disks and Memory 3 05-23-2008 10:21 PM
Need An Idea On How Solaris Work dba SUN Solaris 2 02-27-2008 11:55 AM
Mouse can not work in Solaris 10 Dunhill_Zhao UNIX for Dummies Questions & Answers 2 06-23-2006 05:01 AM
Mouse can not work in Solaris 10 Dunhill_Zhao SUN Solaris 1 06-21-2006 02:17 AM
rcp on solaris doesn't work 0ktalmagik UNIX for Advanced & Expert Users 1 06-16-2006 07:17 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-23-2007
bobk544 bobk544 is offline
Registered User
  
 

Join Date: Jan 2006
Location: fairfax virginia
Posts: 58
ls -d doesn't work on Solaris

Hello, the ls -d command to only list directories in a directory doesn't seem to work on Solaris and the man command says to use that combination: ls -d

Anyone have the same problem and find a resolve?

Thanks
BobK
  #2 (permalink)  
Old 08-23-2007
robotronic's Avatar
robotronic robotronic is offline Forum Advisor  
Can I play with madness?
  
 

Join Date: Apr 2002
Location: Italy
Posts: 370
"ls -d" doesn't display directories. Is used to list directory's name instead of directory's content if the argument passed to ls is a directory.

For example, if you have a directory called TEST and you issue "ls TEST", you will see the list of files in that directory. If you issue "ls -d TEST" you will see only the name of the directory you searched for (TEST).

If you want to display directories try:

Code:
ls -p | grep "/$"
  #3 (permalink)  
Old 08-23-2007
bobk544 bobk544 is offline
Registered User
  
 

Join Date: Jan 2006
Location: fairfax virginia
Posts: 58
thanks ROBOTRONIC! works great, i've been trying to figure that one out for several years believe it or not and now i really need it cos i've got some dirs with hundreds of files in it and can find the dirs easily!\

have a great week/end ROBOTRONIC!

BobK
  #4 (permalink)  
Old 08-23-2007
daveisme daveisme is offline
Registered User
  
 

Join Date: Jul 2007
Posts: 39
you can also use ls -l |grep ^d
for a long list od directories
  #5 (permalink)  
Old 08-23-2007
bobk544 bobk544 is offline
Registered User
  
 

Join Date: Jan 2006
Location: fairfax virginia
Posts: 58
thanks DAVEBEYOU! that works too!
  #6 (permalink)  
Old 08-23-2007
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,847
Or simply:

Code:
printf "%s\n" */
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0