Add $HOME/bin to PATH for a single user in Debian Wheezy with LXDE
Solution 1
It turned out that lightdm
(the login manager LXDE now uses) does not source ~/.profile
.
What worked for me was creating ~/.xsessionrc
:
if [ -d $HOME/bin ]; then
export PATH="$HOME/bin:$PATH"
fi
You can also add this to /etc/X11/Xsession.d/90userbinpath
if you want all user to benefit from this (each user would benefit for his own path) with a system-wide configuration.
Solution 2
You can try the /etc/profile.
nano /etc/profile
There will be two kinds of PATH
, the path for the root, and the path for normal users, non-root. So you just add to the root or normal users the /$HOME/bin on the final of the line Ctrl+O
and Ctrl+X
and there you go :). Remember that you need root to do this operation.
Or, you can go to your home and look at the .profile there.
cd /home/YOURUSERNAME
nano .profile
In debian it automatically does it too(add the bin to the path). Do a echo $HOME
to see what home is.
Related videos on Youtube
user1747781
Updated on September 18, 2022Comments
-
user1747781 over 1 year
I have written a socket-server like here. If I typectrl+c
in telnet, the server don't do anything now. I want to catch it likesignal(SIGINT,SIG_IGN)
How can I do?-
Admin almost 10 yearsNote: Since you speak in the third person, there is a possibility that the user is not you. Then it is considered rude to modify his settings yourself (unless he asked it explicitly, of course).
-
Admin almost 10 yearsDon't worry, the user is me.
-
-
sashoalm almost 10 yearsThis will work for a X session/GUI programs, not just for terminal, right?
-
radianz almost 10 yearsThis will work for both cases GUI and terminal.
-
sashoalm almost 10 yearsOK, I thought GUI programs don't inherit from .bashrc, unless started from a terminal.
-
goldilocks almost 10 yearsBeware you could end up adding
$HOME/bin
to the end of $PATH multiple times this way: unix.stackexchange.com/questions/124444/… -
sashoalm almost 10 yearsOK, .bashrc doesn't work - it seems to work only for programs I start from
xterm
, but not for programs I start using "Alt+F2", i.e. from LXDE (the DE I use). The DE uses a login manager, not startx. -
sashoalm almost 10 yearsThat would be global for all users, I specifically pointed out "for a single user". Wouldn't it be better to use
~/.profile
instead? -
ranu almost 10 years@sashoalm, edited :)
-
sashoalm almost 10 yearsOK, but
.profile
doesn't seem to be executed at all. Is it the correct file to use?echo $PATH
does not show my changes, even from a terminal. I don't have~/.bash_profile
or~/.bash_login
. -
ranu almost 10 yearsTry to exit your session and make a login again, well I don't know if it is the correct file to use, but every user has one, so it would be the answer for your question...
-
sashoalm almost 10 yearsYes, I did that, but it doesn't seem to be read at all. I posted a new question about that - unix.stackexchange.com/questions/131320/…
-
ranu almost 10 yearsAnd more, if you are logged as a user the
echo $HOME
would looks like:/home/yourUserName/
. When you look at the.profile
at the home directory in the final lines you can see that the script add the /bin if it exists. If its not your case I can paste the code for you. -
sashoalm almost 10 yearsI think the problem is I use lxdm - unix.stackexchange.com/a/90946/9108
-
ranu almost 10 yearsYea, that's the problem :(
-
sashoalm almost 10 yearsAdvice worthy of a Windows support tech. If all else fails, make clean reinstall ;) But too late, I already solved the problem - unix.stackexchange.com/a/131327/9108
-
ranu almost 10 yearsCongrats hehe ;)
-
radianz almost 10 yearsCheck my updated answer for running programs using Alt+F2