In Ubuntu Desktop 24
~~~
$ grep VERSION= /etc/os-release
VERSION="24.04.2 LTS (Noble Numbat)"
~~~
When I open a Terminal window my
$PATH
has two copies of /snap/bin
~~~
$ echo $PATH | sed -e 's/:/:\n/g'
/usr/local/sbin:
/usr/local/bin:
/usr/sbin:
/usr/bin:
/sbin:
/bin:
/usr/games:
/usr/local/games:
/snap/bin:
/snap/bin
~~~
I found this is potentially added in both /etc/environment
and in /etc/profile.d/apps-bin-path.sh
~~~
$ sudo grep -n snap.bin /etc/environment /etc/profile.d/apps*sh
/etc/environment:1:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
/etc/profile.d/apps-bin-path.sh:4:snap_bin_path="/snap/bin"
/etc/profile.d/apps-bin-path.sh:5:if [ -n "${PATH##*${snap_bin_path}}" ] && [ -n "${PATH##*${snap_bin_path}:*}" ]; then
/etc/profile.d/apps-bin-path.sh:6: export PATH="$PATH:${snap_bin_path}"
~~~
Perhaps it is added elsewhere too?
If these are the only two files this is added, I guess the /etc/profile.d/apps-bin-path.sh
is being executed before /etc/environment
since the former checks it isn't already present.
If I just want to reduce the number of references to /snap/bin
in my PATH from two to one, which file is safest (or most appropriate) to prune?
Asked by RedGrittyBrick
(2164 rep)
Jun 22, 2025, 03:22 PM
Last activity: Jun 23, 2025, 06:24 AM
Last activity: Jun 23, 2025, 06:24 AM