2

How could I execute a program which I downloaded from website and able to execute from $HOME directory or anywhere in terminal?

Registered User
  • 9,631
  • 14
  • 53
  • 85
taymindis Woon
  • 1,463
  • 5
  • 16
  • 18
  • if you want to run a locally installed application by its application name (as command) take a look here http://askubuntu.com/a/440247/72216, I think it covers your question. (especially the third paragraph) – Jacob Vlijm Apr 04 '14 at 15:56

2 Answers2

3

Lets say the command you have to run to execute the program is ./path/to/file and programs name is xyz

So create a .bash_aliases file in your home directory. Add the line to the file create a alias for the command.

alias xyz="./path/to/file"

Save the file and restart terminal.

Next time you can run the program by typing just xyz

Registered User
  • 9,631
  • 14
  • 53
  • 85
  • Thanks for the answer. Additionally I had to execute 2 separate commands: source ~/.bashrc, and, source ~/.bash_aliases; thanks to this post: https://stackoverflow.com/a/55817651 – gimmegimme Feb 19 '23 at 23:55
2

If you currently have to run your program by giving the full path (say, /home/john/someprogram-1.0/someprogram), you can make it so the program runs by just typing someprogram. For this, you need the program to be somewhere in your PATH, which is a list of directories the shell searches for executables that aren't given as full paths.

There are three ways of accomplishing this:

  1. Install the program. Depending on where it came from, it probably has installation instructions which will place it in a directory already in the path, like /usr/bin. Be aware that installing it this way needs using sudo, or having root privileges.
  2. Add the directory where the program is right now to your path. You can try this manually by first doing export PATH=$PATH:/home/john/someprogram-1.0, then trying to run someprogram only, it should work. TO make this change permanent, add the export command as shown above to your .profile file (this file already exists in your home directory).
  3. Put the program in your private bin directory. Create bin in your home diretory, then copy the someprogram file into this directory. This may not work if the program needs access to other data files.
roadmr
  • 34,222
  • 9
  • 81
  • 93
  • Hi roadmr, no I can't execute because the tar file I downloaded does not have executable file untill I make one and put into usr/bin/ , thanks for your advise:) – taymindis Woon Apr 04 '14 at 18:02