您的当前位置:首页>关注 > 正文

每日消息!nix系统上加载/管理模块的命令 linux常用命令之module

来源:CSDN 时间:2023-03-15 10:13:53

module概述

module是 *nix 系统上加载/管理模块的命令。


(相关资料图)

module安装

大多数发行版上并未默认安装,运行该命令则会出现如下错误:

module: command not found。

需手动执行安装命令,安装软件包 environment-modules:

For CentOS:

[root@localhost ~]# dnf install environment-modules

For Ubuntu:

[miya@localhost ~]# sudo apt-get install environment-modules

注意:安装完成后,已打开的终端要重新打开,命令才能生效。

语法格式

module [options] [command] [args ...]

参考实例

列出已加载的模块:list

[root@localhost ~]# module listNo Modulefiles Currently Loaded.

查看可用模块:avail

[root@localhost ~]# module avail-------------------------------------------------- /usr/share/Modules/modulefiles ---------------------------------------------------dot  module-git  module-info  modules  null  use.own

显示模块信息:show/display

[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}-------------------------------------------------------------------

加载模块:add/load

[root@localhost ~]# module add dot[root@localhost ~]# module load use.own[root@localhost ~]# module listCurrently Loaded Modulefiles: 1) dot   2) use.own

重新加载模块:reload/refresh

[root@localhost ~]# module reload[root@localhost ~]# module refresh

卸载模块:rm/unload

[root@localhost ~]# module listCurrently Loaded Modulefiles: 1) use.own   2) dot[root@localhost ~]# module rm use.own[root@localhost ~]# module unload dot[root@localhost ~]# module listNo Modulefiles Currently Loaded.

清空模块:clear/purge

[root@localhost ~]# module listCurrently Loaded Modulefiles: 1) null[root@localhost ~]# module clearAre you sure you want to clear all loaded modules!? [n] y[root@localhost ~]# module listNo Modulefiles Currently Loaded.[root@localhost ~]# [root@localhost ~]# module listNo Modulefiles Currently Loaded.[root@localhost ~]# module add null[root@localhost ~]# module listCurrently Loaded Modulefiles: 1) null[root@localhost ~]# module purge[root@localhost ~]# module listNo Modulefiles Currently Loaded.

标签:

最新新闻:

新闻放送
Top