Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On my Fedora 16 machine, I have an executable file named 'WarpImageMultiTransform', and I can run it when I cd into the folder that contains it:

[huangchao@localhost bin]$ ./WarpImageMultiTransform --help
./WarpImageMultiTransform ImageDimension moving_image output_image  -R reference_image --use-NN   SeriesOfTransformations--(See Below) 

But when I try to run it from other folder, it says the file doesn't exist:

[huangchao@localhost antsIntro]$  ls /home/huangchao/ANTs-1.9.x-Linux/bin/WarpImageMultiTransform
[huangchao@localhost antsIntro]$ ./home/huangchao/ANTs-1.9.x-Linux/bin/WarpImageMultiTransform --help
-bash: ./home/huangchao/ANTs-1.9.x-Linux/bin/WarpImageMultiTransform: No such file or directory

Does anyone know why?

share|improve this question
up vote 4 down vote accepted

. at the beginning of a path means the path is relative to the current directory. / means it's an absolute path. This command:

ls /home/huangchao/ANTs-1.9.x-Linux/bin/WarpImageMultiTransform

lists absolute directory. But your second command:

./home/huangchao/ANTs-1.9.x-Linux/bin/WarpImageMultiTransform --help

Means: "execute /home/huangchao/ANTs-1.9.x-Linux/bin/WarpImageMultiTransform relatively to my current directory". This will work only if your current directory is /, as it will be equivalent to calling it without the period.

You need the period only to execute files from current directory, other dirs (relative or absolute) don't require a period.

share|improve this answer

I found the answer. Just using

[huangchao@localhost antsIntro]$ /home/huangchao/ANTs-1.9.x-Linux/bin/WarpImageMultiTransform --help

will work.

share|improve this answer

If you want to have easy access to an executable from any directory, you can add the location of the executable file to your $PATH. On *nix systems, if a word is typed into a terminal, the system will search through the directories in the user's path to find an executable with that name.

  • To see your current $PATH do

    echo $PATH
  • To add a directory called new_dir to your $PATH for the current session only do

  • To add a directory called new_dir to your $PATH for every session (assuming you are using bash), add this line to your $HOME/.bashrc file


So, in your case, you would add this line to .bashrc:


You will then be able to execute WarpImageMultiTransform simply by typing the command name wherever you are.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .