$cd upgrade

I don't know about you, but for me, every time I run "$ cd" I always end up running "$ ls -A" right afterwards. It's not something I thought much about but I wondered if there was a way to automate that.

Adding the following code snippet to my .bashrc file put these two functions together and it's made my directory traversal much smoother!

function cd() {
    new_directory="$*";
    if [ $# -eq 0 ]; then 
        new_directory=${HOME};
    fi;
    builtin cd "${new_directory}" && ls -A
}

back to dotfiles

back to homepage

back to tilde.town