module 是 *nix 系统上加载/管理模块的命令。
大多数发行版上并未默认安装,运行该命令则会出现如下错误:
module: command not found。
需手动执行安装命令,安装软件包 environment-modules:
[root@localhost ~]# dnf install environment-modules
[miya@localhost ~]# sudo apt-get install environment-modules
注意:安装完成后,已打开的终端要重新打开,命令才能生效。
module [options] [command] [args ...]
[root@localhost ~]# module list
No Modulefiles Currently Loaded.
[root@localhost ~]# module avail
-------------------------------------------------- /usr/share/Modules/modulefiles ---------------------------------------------------
dot module-git module-info modules null use.own
[root@localhost ~]# module avail
-------------------------------------------------- /usr/share/Modules/modulefiles ---------------------------------------------------
dot module-git module-info modules null use.own
------------------------------------------------------- /root/privatemodules --------------------------------------------------------
null
[root@localhost ~]#
[root@localhost ~]# module show null
-------------------------------------------------------------------
/usr/share/Modules/modulefiles/null:
module-whatis {does absolutely nothing}
-------------------------------------------------------------------
[root@localhost ~]#
[root@localhost ~]# module display module-git
-------------------------------------------------------------------
/usr/share/Modules/modulefiles/module-git:
module-whatis {get last version of the module sources from GitHub}
set-alias get-modules {git clone git://github.com/cea-hpc/modules.git && cd modules}
-------------------------------------------------------------------
[root@localhost ~]# module add dot
[root@localhost ~]# module load use.own
[root@localhost ~]# module list
Currently Loaded Modulefiles:
1) dot 2) use.own
[root@localhost ~]# module reload
[root@localhost ~]# module refresh
[root@localhost ~]# module list
Currently Loaded Modulefiles:
1) use.own 2) dot
[root@localhost ~]# module rm use.own
[root@localhost ~]# module unload dot
[root@localhost ~]# module list
No Modulefiles Currently Loaded.
[root@localhost ~]# module list
Currently Loaded Modulefiles:
1) null
[root@localhost ~]# module clear
Are you sure you want to clear all loaded modules!? [n] y
[root@localhost ~]# module list
No Modulefiles Currently Loaded.
[root@localhost ~]#
[root@localhost ~]# module list
No Modulefiles Currently Loaded.
[root@localhost ~]# module add null
[root@localhost ~]# module list
Currently Loaded Modulefiles:
1) null
[root@localhost ~]# module purge
[root@localhost ~]# module list
No Modulefiles Currently Loaded.