How to check if a directory exists in Linux command line?

How to check if a directory exists in Linux command line?

Solution: [ -d ¨a¨ ]&&echo ¨exists¨||echo ¨not exists¨


$ if test -d /the/dir; then echo "exist"; fi 

Assuming your shell is BASH:

if [ -d /the/dir ]; then echo 'Exists'; else echo 'Not found'; fi

[ -d /home/bla/ ] && echo "exits"