Site icon New Generation Enterprise Linux

Stop cd-ing into directories just to see what is inside

Environment & Shell Customization (Aliases/Functions/.Bashrc)

Stop cd-ing into directories just to see what is inside

🧩 The Challenge

You know that reflex where you type cd followed by ls over and over again until your fingers hurt? It’s a waste of time and it cluttering up your shell history with redundant noise.

💡 The Fix

Combine the directory change and the list command into a single custom shell function that executes automatically. You will stop burning keystrokes and actually see the contents the second you arrive.

cl() { cd "$1" && ls -F; }

⚙️ Why It Works

By wrapping both commands in a function inside your .bashrc, you create a synchronous flow where the second command only triggers if the first one succeeds. It is simple but saves you thousands of unnecessary taps every week.

🚀 Pro-Tip: Alias this to something even shorter like c if your muscle memory is as stubborn as mine.

Linux Tips & Tricks | © ngelinux.com | 10/6/2026

0 0 votes
Article Rating
Exit mobile version