Stop typing cd then ls every single time
Environment & Shell Customization (Aliases/Functions/.Bashrc)
Stop typing cd then ls every single time
🧩 The Challenge
You know that reflex where you type cd into a directory and immediately hammer ls just to see what is there? I have wasted years of my life doing this thousands of times a day.
💡 The Fix
Throw a shell function into your rc file that marries the change directory command with an automatic list. It saves you one repetitive keystroke that adds up to hours of wasted time over a career.
cdls() {
builtin cd "$@" && ls -F
}
alias cd='cdls'
⚙️ Why It Works
Overwriting the standard cd command with a wrapper ensures you never arrive in a directory blind. By using builtin before cd, you avoid infinite recursion loops while keeping your shell experience snappy.
🚀 Pro-Tip: Use ls -F so you can spot your directories and executables at a glance without needing a long-form listing.
Linux Tips & Tricks | © ngelinux.com | 9/14/2026
