Pretty print folder structure using linux terminal?

Solution 1:

You can use the tree command. You might need to install it if it is not already installed.

Solution 2:

A shell only version, usage: dirtree

DIR=${1:-`pwd`}
SPACING=${2:-|} 
cd $DIR 
for x in * ; do
  [ -d $DIR/$x ] && echo "$SPACING\`-{"$x && $0 $DIR/$x "$SPACING "
done