Ubuntu – How to list directories “above” working directory

command line

My professor showed me how to list the directories above the current working directory using the cd command. I thought it was
cd ..[tab]
but this lists commands in my current directory.

Best Answer

I am assuming you just want to list directories on the parent of the current directory, you can use find:

find .. -maxdepth 1 -type d -not -name '..'

Alternately, you can use ls:

ls -p .. | grep '/$'

Or shell:

echo ../*/

or elaborately:

for i in ../*; do [ -d "$i" ] && echo "$i"; done

Or in zsh using glob qualifier / (redundant though :)):

echo ../*(/)