Site icon New Generation Enterprise Linux

Stop typing full paths when you just want to edit a config

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

Stop typing full paths when you just want to edit a config

🧩 The Challenge

You know that feeling when you are deep in a sysctl change or editing a niche systemd override, and you spend more time typing the path than actually editing the file? It kills your flow and I have definitely typoed a path so many times that I ended up creating a bunch of empty garbage files in /etc by accident.

💡 The Fix

Create a function that uses a simple prefix map to jump straight into your most common config directories. It turns a ten-second navigation nightmare into a single command.

cfg() {
local target=${1:-.}
case $target in
sys) cd /etc/sysctl.d ;;
net) cd /etc/netplan ;;
svc) cd /etc/systemd/system ;;
*) cd /etc ;;
esac
}

⚙️ Why It Works

This snippet uses a basic case statement to expand shorthand keywords into full directory paths, which saves you from hitting tab a thousand times. Using the shell function instead of a pile of aliases keeps your environment clean and prevents you from polluting your namespace.

🚀 Pro-Tip: Add a default case that prints a “help” message so you don’t forget which keywords you set up six months from now.

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

0 0 votes
Article Rating
Exit mobile version