Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am using sage a math library in python. After downloading its package, I usually have to go to the directory where I extracted it and then run the the script using

sudo ./sage

from terminal. How can I add sage to the list of installed applications, that I will be able to run the script by typing sage command from any directory in terminal?

share|improve this question

2 Answers 2

up vote 5 down vote accepted

You'll need to add that scripts directory to your PATH variable. This can become tedious if you download a lot of self-contained executables. My recommendation would be to create a bin folder in your home folder and place all your self-contained executable files in there.

Most recent versions of Ubuntu already have their PATH setup to read from $HOME/bin so it'll work after a restart of the terminal or after you type source ~/.profile. Once that's completed you should be able to just enter sage in to the terminal.

If you wanted to add another directory, other than ~/bin, you can open the .profile file in your home directory and add the following line to the bottom:

PATH="/path/to/folder:$PATH"

Replacing /path/to/folder with the absolute path to the directory you wish to add. That will prepend the directory of your choice to your PATH environment and it'll take effect once you enter source ~/.profile (or restart the terminal).

share|improve this answer

Put the script in your bin directory.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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