2

I use lxterminal and this is my $PATH output in lxterminal,

$ echo $PATH
/home/bkc/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

However, inside tmux, some of the locations aren't shown.

$ echo $PATH
/home/bkc/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

What's the reason behind this?

4
  • Starting it in my terminal. tmux -u
    – flipper
    Commented Mar 15, 2020 at 10:44
  • 3
    Because tmux starts a login shell by default, and a login shell sources other initialization files (eg. ~/.bash_profile) than a non-login one (eg. ~/.bashrc).
    – user313992
    Commented Mar 15, 2020 at 12:26
  • See the end of this answer for a workaround.
    – user313992
    Commented Mar 15, 2020 at 12:51
  • @mosvy Thanks, that helped. I entered the locations /usr/sbin and /sbin into ~/.profile, and because login shells sources this file, now, the missing two locations appear while echoing $PATH inside tmux.
    – flipper
    Commented Mar 15, 2020 at 19:05

1 Answer 1

0

Thanks to @mosvy, as per the user's comment, I entered the locations /usr/sbin and /sbin into my ~/.profile file.

Login shells sources ~/.profile and therefore, now the missing locations are shown while echo $PATH.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .