Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am new to Linux so please excuse my ignorance:

On my current work machine if I type:

$ matlab

...the machine is configured so that matlab is executed.

I want to do the same thing for ImageJ ...i.e. typing:

$ ImageJ 

so that ImageJ is executed. This would be helpful as it is annoying to go into the directory and typing ./run

share|improve this question
add comment

3 Answers

First make sure your run file is executable by using the chmod command: chmod +x run.

Then you should create a symbolic link using the ln command which would have the ImageJ binary (the file named run) as the target and /usr/local/bin/ImageJ as the destination.

The /usr/local/bin/ directory is most likely already in your PATH variable (echo $PATH).

When done type use source /etc/profile to update your current bash session (assuming you use bash) and you can now type ImageJ to launch it from any path (see the pwd command).

NB: Note the words in bold, those are commands and you can find more infos on them using man like this: man chmod. Have fun !

share|improve this answer
add comment

You need either to provide the full path to the executable to run it, or you put the directory containing the executable(s) in your PATH variable in order to run it as a regular command.

Using the full path you simply do:

 $ /path/to/imagej/run

To add the directory to your path, add the following to ỳour ~/.bashrc file:

PATH=$PATH:/path/to/imagej/

Source the changes made to that file with source ~/.bashrc and remember to edit these paths to the real ones on your system, accordingly. Now you should be able to run the command run to start it. Possibly rename the run file to something more comprehensible.

share|improve this answer
add comment

Consider renaming the executable as suggested by one of the other answers. A caveat to using the PATH environmental variable to find an executable is that the listed directories will be searched until the first match of your executable is found. A generic name like run might cause a conflict.

A handy sanity check for which executable is actually being run is to execute which run, which will output the absolute path to the executable found by searching the PATH directories. To see the order of directories searched, which is the definition of PATH, execute echo $PATH

Welcome to Linux!

share|improve this answer
add comment

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.