Quick answer: this doesnât seem to be the default config, but itâs harmless. We can investigate further, though:
Details:
I just created a clean testuser
on my system to see, and the resulting PATH
looks like this:
$ echo $PATH | tr : '\n'
/home/testuser/.local/bin
/home/testuser/bin
/usr/lib64/qt-3.3/bin
/usr/share/Modules/bin
/usr/lib64/ccache
/usr/local/bin
/usr/bin
/usr/local/sbin
/usr/sbin
⌠with no duplicates. You may get different results from me, because some of these things are here because of different packages installed on my system. I think the likely things are:
-
You have some configuration of your own that adds /home/username/bin
(maybe expressed as ~/bin
) that youâve been carrying around since before that became part of the defaults. (This is actually the case on my own mattdm
account, which is why I created a test user to look into this.)
-
Or, there is some package that adds it without checking if itâs already there.
Either way, itâs basically harmless â redundant, but the cost of looking twice is very very low.
We can try to figure out whatâs going on by looking at the relevant bash configuration. For case 1, look in /etc/profile.d
for snippets added by various packages:
$ grep -w PATH /etc/profile.d/*
/etc/profile.d/ccache.sh:case ":${PATH:-}:" in
/etc/profile.d/ccache.sh: *) PATH="/usr/lib64/ccache${PATH:+:$PATH}" ;;
/etc/profile.d/qt.sh:case :$PATH: in
/etc/profile.d/qt.sh: *) PATH=$QTDIR/bin:$PATH ;;
/etc/profile.d/qt.sh:export QTDIR QTINC QTLIB PATH
I donât have the redundant home
entries, but you can see from the above where the ccache
and qt
related ones are coming from. I can further investigate with:
$ rpm -qf /etc/profile.d/ccache.sh /etc/profile.d/qt.sh
ccache-4.2.1-2.fc35.x86_64
qt3-3.3.8b-88.fc35.x86_64
to see what packages those specific files come from.
For the second case, look at the file ~/.bash_profile
(or possibly ~/.profile
) for PATH-related lines. In my case for my mattdm
account, I have
export PATH=$HOME/bin:$PATH:$HOME/.cargo/bin
⌠which is what causes the redundant entry for me.
PS: people often ask me âHow do you become a Linux expert?â And the fundamental answer is: by becoming curious about things like this and looking into them. 