Site icon New Generation Enterprise Linux

Stop typing long paths when you constantly jump to deep project directories

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

Stop typing long paths when you constantly jump to deep project directories

🧩 The Challenge

Most of us end up buried three or four levels deep in a project directory, and then we have to cd back out or type absolute paths to move between unrelated deep trees. It turns into a game of “how many double-dots can I type” before I lose my mind.

💡 The Fix

Just create a simple function in your .bashrc that lets you bookmark directories and jump to them by a short tag, rather than remembering the full path. You’ll save yourself dozens of keystrokes every single day.

function cdd() {
case "$1" in
"work") cd /var/www/html/app/current/src/modules/billing ;;
"logs") cd /var/log/nginx/projects/billing/access ;;
*) echo "Unknown tag" ;;
esac
}

⚙️ Why It Works

Using a shell function instead of a massive list of aliases keeps your shell startup fast and avoids polluting your global namespace. Once you define the logic inside that case block, calling it is as fast as typing a command name.

🚀 Pro-Tip: Add a command to print your current path to a file so you can quickly grep your history to add new bookmarks to the function later.

Linux Tips & Tricks | © ngelinux.com | 11/25/2026

0 0 votes
Article Rating
Exit mobile version