Listing only directories in the current working directory using the "ls" command


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Listing only directories in the current working directory using the "ls" command
# 1  
Old 05-11-2006
Listing only directories in the current working directory using the "ls" command

Hello All, I am trying to list only directories in my current directory using the command "ls -d". But the output only contains the default directory "." and doesn't list the rest of the directories in the working directory. Can anyone explain why this is happening
# 2  
Old 05-11-2006
see man

see what man tells -
-d If an argument is a directory, list only its name (not its
contents); often used with -l (ell) to get the status of a
directory.
So, by default the argument is taken as the current directory. To list all directories, ls -ld */
# 3  
Old 05-12-2006
To list all the directories in the current working directory we should be using ls -ld for directories.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Using sed command to replace "|" with ^ for all *.dat files in a folder not working

I am trying to use the below sed command to replace all "|" to ^, in a folder had 50 dat files. when i tried with 1 file it worked but when i tried with wild card, is not working. sed -i 's/"|"/\^/g' *.dat Is this the proper way to use sed command thank you very much for help. (3 Replies)
Discussion started by: cplusplus1
3 Replies

3. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

4. Shell Programming and Scripting

"find . -printf" without prepended "." path? Getting path to current working directory?

If I enter (simplified): find . -printf "%p\n" then all files in the output are prepended by a "." like ./local/share/test23.log How can achieve that a.) the leading "./" is omitted and/or b.) the full path to the current directory is inserted (enclosed by brackets and a blank)... (1 Reply)
Discussion started by: pstein
1 Replies

5. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

6. UNIX for Dummies Questions & Answers

How can I show my "current" directory as the KSH prompt?

Hi All, This is an embarrassingly simple question and couldn't think of "keywords" to search for the answer, but how do I change my UNIX/KSH prompt to show the machine name and my "current" but not "full" directory? For example: if the machine name is "machine" and I'm currently in... (4 Replies)
Discussion started by: chatguy
4 Replies

7. UNIX for Advanced & Expert Users

command for recently modified files - "find" command not working

I have three files a.txt , b.txt , c.txt in a directory called my_dir1 .These files were created before two or three months . I have a tar file called my_tar1.tar which contains three files a.txt , b.txt , d.txt . Somebody untarred the my_tar1.tar into my_dir1 directory. So existing two files were... (1 Reply)
Discussion started by: joe.mani
1 Replies

8. Shell Programming and Scripting

"find command" to find the files in the current directories but not in the "subdir"

Dear friends, please tell me how to find the files which are existing in the current directory, but it sholud not search in the sub directories.. it is like this, current directory contains file1, file2, file3, dir1, dir2 and dir1 conatins file4, file5 and dir2 contains file6,... (9 Replies)
Discussion started by: swamymns
9 Replies

9. Shell Programming and Scripting

bash: cd command to access "strange" directories

I have a problem using bash. Simply, I cannot find the right command (if there's one!) to enter in the "- Arch_02 -" directory. As you can see, the name begins with a hyphen and this is causing some trouble: localhost arch2 # pwd /mnt/arch2 localhost arch2 # ls -l total 4 dr-x------ 1 root... (3 Replies)
Discussion started by: robotronic
3 Replies

10. UNIX for Dummies Questions & Answers

chmod 777 on all directories below...how do I do that using the "find" command?

I've got 100 directories that each have 2 directories with in them. Structered like this: /home/domains/domain1/ through to /home/domains/domain100/ and those 2 directories mentioned above are here: /home/domains/domain1/directory1/ /home/domains/domain1/directory2/ through to... (7 Replies)
Discussion started by: Neko
7 Replies
Login or Register to Ask a Question