Site icon New Generation Enterprise Linux

Stop your shell from forgetting where you were five minutes ago

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

Stop your shell from forgetting where you were five minutes ago

🧩 The Challenge

Everyone has had that moment where they run a command in a directory, jump to a config file somewhere else, and then get completely lost trying to backtrack through a dozen nested folders. Typing cd .. repeatedly is for amateurs and I’m honestly too lazy for that.

💡 The Fix

Just create a simple stack-based navigation function in your bashrc that lets you push your current path and pop back to it whenever you want. It keeps your terminal workflow moving without you having to remember every single jump you made.

pushd_cd() { pushd "$1" > /dev/null; }
alias pop='popd > /dev/null'
alias push='pushd_cd'

⚙️ Why It Works

Adding this to your rc file gives you access to the builtin stack functionality that most people ignore because they think it’s just for shell scripts. Using these aliases makes the commands actually usable in your daily flow since you don’t have to deal with the verbose output flooding your prompt.

🚀 Pro-Tip: Alias your cd to always show the directory stack size if you’re prone to getting lost.

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

0 0 votes
Article Rating
Exit mobile version