How can I see folders from terminal?

to list only folders try: ls -d */


Explanation

-d

list directories themselves, not their contents. To explain this, consider what happens if we type ls */. ls goes one layer down, into each subdirectory, and lists all the files in each of those sequentially

Source: man ls

*/

*/ is known as a "glob" in UNIX. (see Wikipedia for more details). But basically, it means "any file name ending in a forward slash." In UNIX, directories are really just files, fundamentally. But they are specially named ending in a forward slash so the operating system knows they are directories (or folders, in everyday-person-speak). And the asterisk * is technically a wildcard standing for "any string of characters."

What is a glob?

This paragraph will not pertain specifically to your question, but if you've never read about this, it'll be good to see it. Globs are different from Regular Expressions, as (partially) explained in What is the difference between Regular Expressions and Globbing? There have been whole books written on regular expressions, but tl;dr there are a bunch of different ways to encode pattern-matching expressions.


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
  • ...

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.


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