
Stop Spanning export PATH Everywhere: Optimize Your Shell Config
Are you new to Linux? Is your shell config cluttered with export lines at the top, middle, and end? If you type echo $PATH | tr ':' '\n' and see a wall of duplicate paths, you’re doing it the hard way. For those just starting out: your shell config files (like .bashrc or .zshrc ) are hidden files that control environment variables . The most important one is PATH —the list of directories where your terminal searches for commands (like node or python ). Scattered export PATH lines make this list messy and hard to debug. The Common Mess (What You're Probably Doing Now) Most guides tell you to add a tool to your path by appending an export line to your ~/.bashrc (Linux) or ~/.zshrc (macOS). Over time, it looks like this: export PATH = " $HOME /.local/bin: $PATH " # Local user bins export PATH = " $HOME /.nvm/versions/node/v20/bin: $PATH " # Node.js from nvm export PATH = " $HOME /.pyenv/bin: $PATH " # Python from pyenv # New tool export PATH = " $HOME /new-tool/bin: $PATH " # And in some
Continue reading on Dev.to Webdev
Opens in a new tab




