0

This question already has an answer here:

I am trying to execute some binaries manually installed in a bin directory in my $HOME (normal user).

Files are present in /home/user/bin and have exec permission:

$ ls -la ~/bin/
total 120
drwxr-xr-x  2 my_user my_user  4096 déc.   8 12:04 .
drwxr-xr-x 94 my_user my_user  4096 déc.   8 12:23 ..
-rwxr-xr-x  1 my_user my_user  4843 déc.   8 12:04 dplx
-rwxr-xr-x  1 my_user my_user  6515 déc.   8 12:04 dprint
-rwxr-xr-x  1 my_user my_user  2123 déc.   8 12:04 dprintm
-rwxr-xr-x  1 my_user my_user 15494 déc.   8 12:04 duplex
-rwxr-xr-x  1 my_user my_user  6501 déc.   8 12:04 kmprb
-rwxr-xr-x  1 my_user my_user 11069 déc.   8 12:04 kmprb_one
-rwxr-xr-x  1 my_user my_user  5543 déc.   8 12:04 krmpq
-rwxr-xr-x  1 my_user my_user  8267 déc.   8 12:04 mpr
-rwxr-xr-x  1 my_user my_user 25452 déc.   8 12:04 mprb
-rwxr-xr-x  1 my_user my_user  2953 déc.   8 12:04 pqnext
-rwxr-xr-x  1 my_user my_user   896 déc.   8 12:04 rmpq

And ~/.profile contains the call for ~/bin (it's the default on debian).

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

However, binaries are not recognized after a reboot:

$ duplex
bash: duplex : commande introuvable

I also tried source .bashrc and source .profile. The second one works but just for the terminal (if I close it and reopen a new one, the command isn't recognize anymore).

How could I permanently install these binaries?

marked as duplicate by Bananguin, polemon, Raphael Ahrens, dhag, roaima Dec 8 '15 at 22:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • "~/.profile: executed by the command interpreter for login shells. # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login # exists." It begs the question, do you have a .bash_profile or .bash_login file? – Rui F Ribeiro Dec 8 '15 at 11:43
  • 4
    This looks like a duplicate of unix.stackexchange.com/q/170156/19575 At least the problem is the same. – Bananguin Dec 8 '15 at 11:55
0

The file(s) profile are meant to be read by all shells on start for login shells. Either the system wide /etc/profile (and /etc/profile.d) or the user added file ~/.profile.

For interactive, non-login shells, (most of the shells) you should use the file(s) .bashrc.

Just move the code:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

from ~/.profile to ~/.bashrc.

Or, alternative (I really do not recommend that) source ~/.profile in ~/.bashrc.

To better understand the way the files are used, please look at this image.

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