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 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). Commented Mar 15, 2020 at 12:26
  • See the end of this answer for a workaround. 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. 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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.