Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

How can I list folders from within the terminal, which command should I use?

share|improve this question

6 Answers 6

up vote 2 down vote accepted

If you want to be able to distinguish folders from files easily, use something like ls -alhF. I usually define l as an alias for that, ie. I put the line alias l='ls -alhF' in my .bashrc.

share|improve this answer

to list only folders try: ls -d */

share|improve this answer
    
How to show hidden folders as well? ls -d .*/ shows only hidden folders. How to view BOTH hidden and non-hidden folders? I can only think of ls -d */ .*/ Anything better? –  LFC_fan Oct 26 '10 at 13:16
    
well, you can try ls -la | grep ^d but it is much longer :) –  Paweł Karpiński Oct 26 '10 at 13:40

As I am a very inexperienced user I love this website. It tells you all you want to know about bash commands, in some cases it even gives you examples. Very useful.

In your case:

  • ls to list the files
  • ls -a to include hidden files
  • ls -l for a long listing format
  • ...
share|improve this answer
ls -al | grep ^d

include hidden files '-a' grep ^d get start with 'd' wich means directory when name starts with dot directory is hidden

to list recursively see this

find ./ -type d | less
./ ..................... means starts find in current folder
-type .................. indicates the type to be searched
d ...................... means directory
| ...................... redirects the command
less ................... enables paging using the keyboard arrows and leave with q
share|improve this answer
ls -1 -d */

where

-1

lists one directory per line.

share|improve this answer

ls will list the files.

ls -l will list the files with details (such as file size).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.