0

I know that when I install a program from source is possible to make it run in terminal only by typing its name using these two ways

  1. copy executable file from home directory to /usr/local/bin.
  2. add its path to the PATH in ~/.bashrc file.

Which file (or better to say which type of file) from home directory I should add to /usr/local/bin? Please do not tell me just executable! I saw a lot of executable files in my home/myprogram directory with this command:

find . -perm -u+x -type f

from How to find executables. Also there is a file named myprogram. Should I add this to /usr/local/bin?

Mohammad Reza Rezwani
  • 10,286
  • 36
  • 92
  • 128
  • 1
    alex what is the question? How is this different from your previous qestion? – rusty Mar 30 '14 at 07:13
  • @rusty I try to edit :-D – Mohammad Reza Rezwani Mar 30 '14 at 07:15
  • what's the "program directory"? what file are you trying to copy, why? (what are you trying to achieve?) – rusty Mar 30 '14 at 07:21
  • @rusty I downloaded a software from source and I installed it but know I do not know copy which file to /usr/local/bin also the reason of this copy is to make it run in termianl also I refuse tp add its PATH to bashrc – Mohammad Reza Rezwani Mar 30 '14 at 07:25
  • 2
    I think the package should have some script like configure or something to make such things easy for you.. check this link: installing from source – rusty Mar 30 '14 at 07:29
  • @Jobin please follow rusty's upper command until I edit my question – Mohammad Reza Rezwani Mar 30 '14 at 07:32
  • I will be happy If someone who understand my question make it EDIT – Mohammad Reza Rezwani Mar 30 '14 at 07:38
  • 2
    Usually you build and install from sources like this: ./configure && make && sudo make install. Make install copies the files for you to correct locations. If you need to manually copy files, then something is not right. – juzzlin Mar 30 '14 at 07:41
  • @Radu thnks first edit – Mohammad Reza Rezwani Mar 30 '14 at 08:36
  • You don't need to "manually" copy any executable to your /(s)bin directories if the sources has a Makefile. What are you trying to do? – Braiam Mar 30 '14 at 23:55
  • @Braiam suppose my program name is 'NS'. What I am trying to is when in terminal I write NS, my program start to work. But I do not need to add its PATH to my bashrc. I just want to use /(s)bin or /usr/local/(s)bin. My question is this ? which file from my software(which I downloaded from source) I should copy to (s)bin?But about Makefile I do not know how I should use this(Makefile) for that purpose? By the way I have Makefile in my program directory. – Mohammad Reza Rezwani Mar 31 '14 at 04:40
  • If you don't tell us what program it's we will not be able to know. Most sources has installation methods where you don't need to copy anything, and everything is done by the helper. "which file from my software(which I downloaded from source) I should copy to (s)bin?" It's not needed. Also, without the name of the software we couldn't possibly know. – Braiam Mar 31 '14 at 04:47
  • In this program in the manual they announce to add PATH to bashrc . But I do not like to do that I wanna use /bin – Mohammad Reza Rezwani Mar 31 '14 at 05:27

1 Answers1

0

Whatever you try to do or to archive, please try as much as possible to not add your executable files in a system directory like /usr/local/bin. This can be unpleasant for other users who use the same system.

You can put your executable files in your ~/bin directory. If you don't have already one, create it:

mkdir -p ~/bin

This directory is already added to your PATH as you can see in the last lines from your ~/.profile file. So, any executable that you put there can be run only by typing it's name.

And which file to add? - Any file you want, nobody (other than you) and nothing will be disturbed because of this.

In case of a program installed from sources you better create a symbolic link to the executable file which starts the program, instead to copy the executable file:

ln -s /path/to/program/executable_file ~/bin
Radu Rădeanu
  • 169,590