Access to many applications and libraries is controlled by the modules utility. The module command allows you to easily manipulate your Linux environment to use various applications and programming libraries, sometimes including older or newer versions than the default. When you need to change your environment you simply load or unload modules. Here are some of the commands you’ll need.

List the software that’s available via the module command:

[username@linuxremote1 ~]$ module avail

----------------------- /usr/remote/etc/modulefiles ------------------------
adina/9.2.2                  java/1.7
adina/9.3.1(default)         java/1.8(default)
amber/16(default)            last/737(default)
angsd/0.918(default)         mathematica/10.1.0
augustus/3.2.2(default)      mathematica/11.1.1(default)
bamtools/2.4.0(default)      matlab/R2015a
BUSCO/1.1b1(default)         matlab/R2016a
bwa/0.7.15(default)          matlab/R2017a(default)
caffe/1.0.0                  mono/5.4(default)
cmake/2.8.8                  ncbi-blast+/2.2.31(default)
cmake/3.6.1(default)         node/4.1.1(default)
comsol/research-5.2a         null
comsol/research-5.3(default) perl/5.22
crb-blast/0.6.6(default)     perl/5.24(default)
csci208/langs                plink/1.1
CUDA/7.5                     plink/1.9(default)
CUDA/8.0(default)            python/2.7
cudnn/5.1                    python/3.2
cudnn/6.0(default)           python/3.4
dammit/0.2.8(default)        python/3.5
DRAP/1.9(default)            python/3.6(default)
elm/0.17.1(default)          python/anaconda-2.7
EMBOSS/6.5.7(default)        python/anaconda-3.5
ffmpeg/0.10.16               python/anaconda-3.6
fv/5.4(default)              R/3.3.0
gaussian/09                  R/3.4.1(default)
gaussian/16(default)         RNMRTK/3.2(default)
gaussian/16-avx              ROOT/6.06.08(default)
gaussian/16-avx2             ruby/2.3.0(default)
gcc/6.3(default)             samtools/1.1
git/2.9(default)             samtools/1.6(default)
gromacs/2016.1(default)      singularity/DRAP
GT-SUITE/7.5.0B4(default)    singularity/pycharm
hmmer/3.1b2(default)         singularity/tensorflow
infernal/1.1.1(default)      TransDecoder/2.1.0(default)
java/1.6                     vcftools/0.1.15(default)

----------------------------- /etc/modulefiles -----------------------------
mpi/mpich-3.0-x86_64 mpi/mpich-x86_64
mpi/mpich-3.2-x86_64 mpi/openmpi-x86_64

List the software that’s currently loaded in your environment (NOTE: some software is loaded by default when you login to a Bucknell Linux system):

[username@linuxremote1 ~]$ module list
Currently Loaded Modulefiles:
  1) python/3.2

Load/add a software package into your environment:

[username@linuxremote1 ~]$ module load matlab/R2017a

You can also load the default version of a software package by dropping the version:

[username@linuxremote1 ~]$ module load matlab

Unload/remove a software package from your environment:

[username@linuxremote1 ~]$ module unload matlab/R2017a

Modules will prevent you from adding conflicting packages. For example, you’ll receive an error if you try to add two versions of Python to your environment. To change to a new version, either unload one version and load another or use the switch command:

[username@linuxremote1 ~]$ module list
Currently Loaded Modulefiles:
  1) python/3.6
[username@linuxremote1 ~]$ module switch python/2.7

To add modules to your Linux environment that will load every time you login, use:
(NOTE: only run the echo command once; then just use initadd to add additional modules):

[username@linuxremote1 ~]$ echo "module add null" >> ~/.bashrc
[username@linuxremote1 ~]$ module initadd node/4.1.1

(NOTE: if you use the tcsh shell, you’ll need to run echo “module add null” >> ~/.cshrc)

Likewise, you can remove commands from your initial environment using:

[username@linuxremote1 ~]$ module initrm node/4.1.1

For additional commands, run:

[username@linuxremote1 ~]$ module help

For additional information or assistance, please contact the Tech Desk at 570.577.7777 or techdesk@bucknell.edu.

Keywords: linux, environment

Tagged: