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

$ echo $PATH

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

$ echo $PATH

What's the reason behind this?

  • Starting it in my terminal. tmux -u
    – flipper
    Mar 15 '20 at 10:44
  • 2
    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).
    – mosvy
    Mar 15 '20 at 12:26
  • See the end of this answer for a workaround.
    – mosvy
    Mar 15 '20 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
    Mar 15 '20 at 19:05

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.