Automatically ls after cd (improved)

Here’s the new and improved version. This will properly handle a cd with no arguments.

alias cdd="builtin cd"
cd () {
        if [ "$*" = "" ]; then
                builtin cd ~
        else
                builtin cd "$*"
                        fi  
                        if [ $? -eq 0 ]; then
                                        ls --color=always
                                        fi  
}

One thought on “Automatically ls after cd (improved)

Leave a Reply

Your email address will not be published. Required fields are marked *