1MODULE(1) Modules package MODULE(1)
2
3
4
6 module - command interface to the Modules package
7
9 module [ switches ] [ sub-command ] [ sub-command-args ]
10
12 module is a user interface to the Modules package. The Modules package
13 provides for the dynamic modification of the user's environment via
14 modulefiles.
15
16 Each modulefile contains the information needed to configure the shell
17 for an application. Once the Modules package is initialized, the
18 environment can be modified on a per-module basis using the module
19 command which interprets modulefiles. Typically modulefiles instruct
20 the module command to alter or set shell environment variables such as
21 PATH, MANPATH, etc. modulefiles may be shared by many users on a
22 system and users may have their own collection to supplement or replace
23 the shared modulefiles.
24
25 The modulefiles are added to and removed from the current environment
26 by the user. The environment changes contained in a modulefile can be
27 summarized through the module command as well. If no arguments are
28 given, a summary of the module usage and sub-commands are shown.
29
30 The action for the module command to take is described by the sub-
31 command and its associated arguments.
32
33 Package Initialization
34 The Modules package and the module command are initialized when a
35 shell-specific initialization script is sourced into the shell. The
36 script creates the module command, either as an alias or shell
37 function, creates Modules environment variables, and if enabled to do
38 so, a snapshot of the environment is saved as either (if BEGINENV=1)
39 $HOME/.modulesbeginenv or (if BEGINENV=99) whatever $MODULESBEGINENV
40 points to.
41
42 The module alias or function executes the modulecmd program and has the
43 shell evaluate the command's output. The first argument to modulecmd
44 specifies the type of shell.
45
46 The initialization scripts are kept in $MODULESHOME/init/<shell> where
47 <shell> is the name of the sourcing shell. The sh, csh, tcsh, bash,
48 ksh, and zsh shells are supported by modulecmd. In addition, python,
49 perl, and cmake "shells" are supported, which writes the environment
50 changes to stdout as python, perl, or cmake code.
51
52 The perl module command is set up with:
53
54 use lib $ENV{'MODULESHOME'}."/init";
55 use perl;
56
57 And the python module command is defined with:
58
59 import os;
60 if os.environ.has_key('PYTHONPATH'):
61 os.environ['PYTHONPATH'] +=':'+os.environ['MODULESHOME']+"/init";
62 else:
63 os.environ['PYTHONPATH'] = os.environ['MODULESHOME']+"/init";
64
65 from python import module;
66
67
68 Modulecmd startup
69 Upon invocation modulecmd sources rc files which contain global, user
70 and modulefile specific setups. These files are interpreted as
71 modulefiles. See modulefile(4) for detailed information.
72
73 Upon invocation of modulecmd module RC files are sourced in the
74 following order:
75
76 Global RC file as specified by ${MODULERCFILE} or ${MODULESHOME}/etc/rc
77
78 User specific module RC file ${HOME}/.modulerc
79
80 All .modulerc and .version files found during modulefile seeking.
81
82
83 Command line switches
84 The module command accepts command line switches as its first
85 parameter. These may be used to control output format of all
86 information displayed and the module behavior in case of locating and
87 interpreting module files.
88
89 All switches may be entered either in short or long notation. The
90 following switches are accepted:
91
92 --help, -H
93 Give some helpful usage information, and terminates the command.
94
95 --version, -V
96 Lists the current version of the module command, and some
97 configured option values. The command then terminates without
98 further processing.
99
100 --force, -f
101 Force active dependency resolution. This will result in modules
102 found on a prereq command inside a module file being load
103 automatically. Unloading module files using this switch will
104 result in all required modules which have been loaded
105 automatically using the -f switch being unload. This switch is
106 experimental at the moment.
107
108 --terse, -t
109 Display avail and list output in short format.
110
111 --long, -l
112 Display avail and list output in long format.
113
114 --human, -h
115 Display short output of the avail and list commands in human
116 readable format.
117
118 --verbose, -v
119 Enable verbose messages during module command execution.
120
121 --silent, -s
122 Disable verbose messages. Redirect stderr to /dev/null if stderr
123 is found not to be a tty. This is a useful option for module
124 commands being written into .cshrc, .login or .profile files,
125 because some remote shells (as rsh(1)) and remote execution
126 commands (like rdist) get confused if there is output on stderr.
127
128 --create, -c
129 Create caches for module avail and module apropos. You must be
130 granted write access to the ${MODULEHOME}/modulefiles/ directory
131 if you try to invoke module with the -c option.
132
133 --icase, -i
134 Case insensitive module parameter evaluation. Currently only
135 implemented for the module apropos command.
136
137 --userlvl <lvl>, -u <lvl>
138 Set the user level to the specified value. The argument of this
139 option may be one of:
140
141 novice, nov Novice
142
143 expert, exp Experienced module user
144
145 advanced, adv Advanced module user
146
147 Module Sub-Commands
148 help [modulefile...]
149 Print the usage of each sub-command. If an
150 argument is given, print the Module-specific help
151 information for the modulefile(s).
152
153 add modulefile...
154 load modulefile...
155 Load modulefile(s) into the shell environment.
156
157 rm modulefile...
158 unload modulefile...
159 Remove modulefile(s) from the shell environment.
160
161 swap [modulefile1] modulefile2
162 switch [modulefile1] modulefile2
163 Switch loaded modulefile1 with modulefile2. If
164 modulefile1 is not specified, then it is assumed
165 to be the currently loaded module with the same
166 root name as modulefile2.
167
168 show modulefile...
169 display modulefile...
170 Display information about one or more
171 modulefiles. The display sub-command will list
172 the full path of the modulefile(s) and all (or
173 most) of the environment changes the
174 modulefile(s) will make if loaded. (It will not
175 display any environment changes found within
176 conditional statements.)
177
178 list List loaded modules.
179
180 avail [path...]
181 List all available modulefiles in the current
182 MODULEPATH. All directories in the MODULEPATH
183 are recursively searched for files containing the
184 modulefile magic cookie. If an argument is
185 given, then each directory in the MODULEPATH is
186 searched for modulefiles whose pathname match the
187 argument. Multiple versions of an application
188 can be supported by creating a subdirectory for
189 the application containing modulefiles for each
190 version.
191
192 use [-a|--append] directory...
193 Prepend one or more directories to the MODULEPATH
194 environment variable. The --append flag will
195 append the directory to MODULEPATH.
196
197 unuse directory...
198 Remove one or more directories from the
199 MODULEPATH environment variable.
200
201 update Attempt to reload all loaded modulefiles. The
202 environment will be reconfigured to match the
203 environment saved in ${HOME}/.modulesbeginenv (if
204 BEGINENV=1) or the file pointed at by
205 $MODULESBEGINEV (if BEGINENV=99) and the
206 modulefiles will be reloaded. This is only valid
207 if modules was configured with --enable-beginenv
208 (which defines BEGINENV), otherwise this will
209 cause a warning. update will only change the
210 environment variables that the modulefiles set.
211
212 clear Force the Modules package to believe that no
213 modules are currently loaded.
214
215 purge Unload all loaded modulefiles.
216
217 refresh Force a refresh of all non-persistent components
218 of currently loaded modules. This should be used
219 on derived shells where aliases need to be
220 reinitialized but the environment variables have
221 already been set by the currently loaded modules.
222
223 whatis [modulefile...]
224 Display the information set up by the module-
225 whatis commands inside the specified
226 modulefile(s). If no modulefile is specified, all
227 'whatis' lines will be shown.
228
229 apropos string
230 keyword string Seeks through the 'whatis' informations of all
231 modulefiles for the specified string. All
232 module-whatis informations matching the string
233 will be displayed.
234
235 initadd modulefile...
236 Add modulefile(s) to the shell's initialization
237 file in the user's home directory. The startup
238 files checked (in order) are:
239 csh - .modules, .cshrc(.ext), .csh_variables, and
240 .login(.ext)
241 tcsh - .modules, .tcshrc, .cshrc(.ext),
242 .csh_variables, and .login(.ext)
243 sh and ksh - .modules, .profile(.ext), and
244 .kshenv(.ext)
245 bash - .modules, .bash_profile, .bash_login,
246 .profile(.ext), and .bashrc(.ext)
247 zsh - .modules, .zcshrc(.ext), .zshenv(.ext), and
248 .zlogin(.ext)
249
250 If a 'module load' line is found in any of these
251 files, the modulefile(s) is(are) appended to any
252 existing list of modulefiles. The 'module load'
253 line must be located in at least one of the files
254 listed above for any of the 'init' sub-commands
255 to work properly. If the 'module load' line is
256 found in multiple shell initialization files, all
257 of the lines are changed.
258
259 initprepend modulefile [modulefile...]
260 Does the same as initadd but prepends the given
261 modules to the beginning of the list.
262
263 initrm modulefile...
264 Remove modulefile(s) from the shell's
265 initialization files.
266
267 initswitch modulefile1 modulefile2
268 Switch modulefile1 with modulefile2 in the
269 shell's initialization files.
270
271 initlist List all of the modulefiles loaded from the
272 shell's initialization file.
273
274 initclear Clear all of the modulefiles from the shell's
275 initialization files.
276
277 Modulefiles
278 modulefiles are written in the Tool Command Language (Tcl) and are
279 interpreted by modulecmd. modulefiles can use conditional statements.
280 Thus the effect a modulefile will have on the environment may change
281 depending upon the current state of the environment.
282
283 Environment variables are unset when unloading a modulefile. Thus, it
284 is possible to load a modulefile and then unload it without having the
285 environment variables return to their prior state.
286
288 MODULESHOME
289 The location of the master Modules package file directory
290 containing module command initialization scripts, the executable
291 program modulecmd, and a directory containing a collection of
292 master modulefiles.
293
294 MODULEPATH
295 The path that the module command searches when looking for
296 modulefiles. Typically, it is set to a default value by the
297 bootstrap procedure. MODULEPATH can be set using 'module use'
298 or by the module initialization script to search group or
299 personal modulefile directories before or after the master
300 modulefile directory.
301
302 LOADEDMODULES
303 A colon separated list of all loaded modulefiles.
304
305 _LMFILES_
306 A colon separated list of the full pathname for all loaded
307 modulefiles.
308
309 MODULESBEGINENV
310 If modules has been configured (BEGINENV=99) to test for this
311 environment variable, then if it exists, it is the name of the
312 file to store the the initial shell environment. This
313 environment variable will have embedded environment variables
314 unrolled to one level. The contents of this variable is only
315 used the first time modules is invoked.
316
317 _MODULESBEGINENV_
318 The filename of the file containing the initialization
319 environment snapshot.
320
321
323 /usr/share/Modules
324 The MODULESHOME directory.
325
326 ${MODULESHOME}/etc/rc
327 The system-wide modules rc file. The location of this file can
328 be changed using the MODULERCFILE environment variable as
329 described above.
330
331 ${HOME}/.modulerc
332 The user specific modules rc file.
333
334 ${MODULESHOME}/modulefiles
335 The directory for system-wide modulefiles. The location of the
336 directory can be changed using the MODULEPATH environment
337 variable as described above.
338
339 ${MODULESHOME}/bin/modulecmd
340 The modulefile interpreter that gets executed upon each
341 invocation of module.
342
343 ${MODULESHOME}/init/<shell>
344 The Modules package initialization file sourced into the user's
345 environment.
346
347 ${MODULEPATH}/.moduleavailcache
348 File containing the cached list of all modulefiles for each
349 directory in the MODULEPATH (only when the avail cache is
350 enabled via the configure option --enable-cache which sets
351 CACHE_AVAIL).
352
353 ${MODULEPATH}/.moduleavailcachedir
354 File containing the names and modification times for all sub-
355 directories with an avail cache (see above).
356
357 ${HOME}/.modulesbeginenv
358 A snapshot of the user's environment taken at Module
359 initialization. This information is used by the module update
360 sub-command (if BEGINENV=1), else
361
362 $MODULESBEGINENV
363 If this defines a valid filename, it serves the same purpose as
364 above (if BEGINENV=99).
365
367 3.2.8
368
370 modulefile(4)
371
372
373
374Modules version 3.2.8 July 2009 MODULE(1)