To start an application on the Linux command line one has to know its name and its location. Important applications like editors or other tools can be found in the /usr/bin/ directory. To start the editor “nano” one can enter the following command on the command line:
However, the /usr/bin directory is also listed in the so called “PATH” environment variable. All applications in directories which are listed in the PATH variable can be run by simply typing their name. In case of the “nano” editor:
To check what directories are currently listed in the PATH variable you can print its content with:
If you want to start your own application which is not in a directory in the PATH variable, you always need to enter the path where the application can be found. If you are currently within the directory of the application you have to type
to start it. Otherwise the shell will search for “my-application” within all directories listened in the PATH variable.
You can add directories to the PATH variable by running the following command:
The shell will replace $PATH with the current content of the PATH variable and add whatever you write after it. The directories are separated by a colon.
Supercomputers with Modules
If you are lucky, your administrator installed Modules on your cluster and configured the application you want to run in it. If she did this correctly you only need to load the appropriate module and start your application by its name. The Modules tool adds the location to your PATH variable (and other needed stuff)
So for example if you want to run Gromacs you don’t even have to know where it is installed on your systems. Just search for the module in the output of
and add the module via
module load gromacs/5.1.0
Now to start Gromacs you only need to enter “gromacs”.