cmd to view only directories


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting cmd to view only directories
# 1  
Old 04-05-2006
cmd to view only directories

Hi All,

Plz tell me the cmd of viewing only directories. Suppose i am at bin directory and it contains another directory mails with lotz of files in it.

Now when ever I do ls -lt mails under bin directory it shows me all the files inside mails dir . But I just want to see only mails dir as an output not all of its contents(i.e files inside mails dir). Is there any switch for displaying directories only.

Plz let me know. I would be thankful. I am working on Solaris 5.8 platform.


Thnx..
Aru
# 2  
Old 04-05-2006
If I understand your questions try:
Code:
ls .

This gives the files that live in the current directory, including the names of directories but not the files in those directories.
# 3  
Old 04-05-2006
ls -d */

Only list the directories in the current directory

cheers

swapneel
# 4  
Old 04-05-2006
ls -d */

Only list the directories in the current directory

cheers

swapneel
# 5  
Old 04-05-2006
Dear friend thanks for reply. I have tried uising ls -d */ but its giving me following error

$ ls -d */
*/: No such file or directory

But there are few directories in bin folder. Please suggest some other solution.

Aru.
# 6  
Old 04-05-2006
hi

try ls */

or

visit this page http://www.computerhope.com/unix/uls.htm
and have a look at directoy of file

Cheers

Swapneel
# 7  
Old 04-06-2006
try
ls -l|grep ^d
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. What is on Your Mind?

Moving from Desktop View to Mobile View

See attached video for a demo on how to move back and forth from the desktop view to the mobile view. Currently this only works for the home page, but I will work on some new PHP code in the future to make this work with the page we are currently on. Edit: The issue with making every page ... (2 Replies)
Discussion started by: Neo
2 Replies

2. Solaris

Giving read write permission to user for specific directories and sub directories.

I have searched this quite a long time but couldn't find the right method for me to use. I need to assign read write permission to the user for specific directories and it's sub directories and files. I do not want to use ACL. This is for Solaris. Please help. (1 Reply)
Discussion started by: blinkingdan
1 Replies

3. Shell Programming and Scripting

Help with tar cmd for directories

Hi, I'm working on HP-UX B.11.23 64bit. I tried to tar couple of directories but failed to do so. $ tar -cvf tar_file_name -C /dir1 /dir2 the -C is for directories as mentioned in the man pages. But still unable to create a tar file having directories and sub-directories. Requesting help in... (1 Reply)
Discussion started by: sam_bd
1 Replies

4. UNIX for Dummies Questions & Answers

List the directories, having given pattern in the directories name, sorted by creation date

It is for HP-Unix B.11.31. Requirement: 1. List the directories, having given pattern in the directories name, sorted by creation date. Example: Directories with name "pkg32*" or "pkg33*" 2. On the output of 1. list the directories by creation date as sort order, with creation date... (2 Replies)
Discussion started by: Siva SQL
2 Replies

5. Shell Programming and Scripting

Perl open(CMD, "cmd |"); buffering problem..

Hello, There's a third-party application's command that shows the application's status like "tail -f verybusy.log". When use the command, the output comes every 1-sec. but when it goes in a script below the output comes every 8-sec...What is the problem and how can I fix it? open(CMD,... (2 Replies)
Discussion started by: Shawn, Lee
2 Replies

6. Shell Programming and Scripting

Unix cmd prompt how to get old cmd run?

Hi, I am using SunOS I want to serch my previous command from unix prompt (like on AIX we can search by ESC -k) how to get in SunOs urgent help require. (10 Replies)
Discussion started by: RahulJoshi
10 Replies

7. Shell Programming and Scripting

Script for parsing directories one level and finding directories older than n days

Hello all, Here's the deal...I have one directory with many subdirs and files. What I want to find out is who is keeping old files and directories...say files and dirs that they didn't use since a number of n days, only one level under the initial dir. Output to a file. A script for... (5 Replies)
Discussion started by: ejianu
5 Replies

8. UNIX for Dummies Questions & Answers

man <cmd> >> cmd.txt

I've noticed most of my postings here are because of syntax errors. So I want to begin compiling a large txt file that contains all the "man <cmd>" of the commands I most have problems with. I ran a "man nawk >> nawk.txt" but it included a header/footer on each "page". Anyone know how I'd be... (6 Replies)
Discussion started by: yongho
6 Replies
Login or Register to Ask a Question