PATH manipulation in bash
PATH manipulation in bash
September 13, 2025
Here are a couple of bash functions to add or remove an entry from
the PATH environment variable. Add them to your ~/.bashrc.
To append an entry to PATH:
addpath () { export PATH="${PATH}:${1}"; }To remove an entry from PATH:
rmpath () { export PATH=`ruby -e "puts ENV['PATH'].split(':').reject{|x|x==ARGV[0]}.join(':')" -- ${1}`; }