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, where the sorting order is given by
183 the LC_COLLATE locale environment variable.
184
185 All directories in the MODULEPATH are recursively
186 searched for files containing the modulefile
187 magic cookie.
188
189 If an argument is given, then each directory in
190 the MODULEPATH is searched for modulefiles whose
191 pathname match the argument.
192
193 Multiple versions of an application can be
194 supported by creating a subdirectory for the
195 application containing modulefiles for each
196 version.
197
198 use [-a|--append] directory...
199 Prepend one or more directories to the MODULEPATH
200 environment variable. The --append flag will
201 append the directory to MODULEPATH.
202
203 unuse directory...
204 Remove one or more directories from the
205 MODULEPATH environment variable.
206
207 update Attempt to reload all loaded modulefiles. The
208 environment will be reconfigured to match the
209 environment saved in ${HOME}/.modulesbeginenv (if
210 BEGINENV=1) or the file pointed at by
211 $MODULESBEGINEV (if BEGINENV=99) and the
212 modulefiles will be reloaded. This is only valid
213 if modules was configured with --enable-beginenv
214 (which defines BEGINENV), otherwise this will
215 cause a warning. update will only change the
216 environment variables that the modulefiles set.
217
218 clear Force the Modules package to believe that no
219 modules are currently loaded.
220
221 purge Unload all loaded modulefiles.
222
223 refresh Force a refresh of all non-persistent components
224 of currently loaded modules. This should be used
225 on derived shells where aliases need to be
226 reinitialized but the environment variables have
227 already been set by the currently loaded modules.
228
229 whatis [modulefile...]
230 Display the information set up by the module-
231 whatis commands inside the specified
232 modulefile(s). If no modulefile is specified, all
233 'whatis' lines will be shown.
234
235 apropos string
236 keyword string Seeks through the 'whatis' informations of all
237 modulefiles for the specified string. All
238 module-whatis informations matching the string
239 will be displayed.
240
241 initadd modulefile...
242 Add modulefile(s) to the shell's initialization
243 file in the user's home directory. The startup
244 files checked (in order) are:
245 csh - .modules, .cshrc(.ext), .csh_variables, and
246 .login(.ext)
247 tcsh - .modules, .tcshrc, .cshrc(.ext),
248 .csh_variables, and .login(.ext)
249 sh and ksh - .modules, .profile(.ext), and
250 .kshenv(.ext)
251 bash - .modules, .bash_profile, .bash_login,
252 .profile(.ext), and .bashrc(.ext)
253 zsh - .modules, .zcshrc(.ext), .zshenv(.ext), and
254 .zlogin(.ext)
255
256 If a 'module load' line is found in any of these
257 files, the modulefile(s) is(are) appended to any
258 existing list of modulefiles. The 'module load'
259 line must be located in at least one of the files
260 listed above for any of the 'init' sub-commands
261 to work properly. If the 'module load' line is
262 found in multiple shell initialization files, all
263 of the lines are changed.
264
265 initprepend modulefile [modulefile...]
266 Does the same as initadd but prepends the given
267 modules to the beginning of the list.
268
269 initrm modulefile...
270 Remove modulefile(s) from the shell's
271 initialization files.
272
273 initswitch modulefile1 modulefile2
274 Switch modulefile1 with modulefile2 in the
275 shell's initialization files.
276
277 initlist List all of the modulefiles loaded from the
278 shell's initialization file.
279
280 initclear Clear all of the modulefiles from the shell's
281 initialization files.
282
283 Modulefiles
284 modulefiles are written in the Tool Command Language (Tcl) and are
285 interpreted by modulecmd. modulefiles can use conditional statements.
286 Thus the effect a modulefile will have on the environment may change
287 depending upon the current state of the environment.
288
289 Environment variables are unset when unloading a modulefile. Thus, it
290 is possible to load a modulefile and then unload it without having the
291 environment variables return to their prior state.
292
294 MODULESHOME
295 The location of the master Modules package file directory
296 containing module command initialization scripts, the executable
297 program modulecmd, and a directory containing a collection of
298 master modulefiles.
299
300 MODULEPATH
301 The path that the module command searches when looking for
302 modulefiles. Typically, it is set to a default value by the
303 bootstrap procedure. MODULEPATH can be set using 'module use'
304 or by the module initialization script to search group or
305 personal modulefile directories before or after the master
306 modulefile directory.
307
308 LOADEDMODULES
309 A colon separated list of all loaded modulefiles.
310
311 _LMFILES_
312 A colon separated list of the full pathname for all loaded
313 modulefiles.
314
315 MODULESBEGINENV
316 If modules has been configured (BEGINENV=99) to test for this
317 environment variable, then if it exists, it is the name of the
318 file to store the the initial shell environment. This
319 environment variable will have embedded environment variables
320 unrolled to one level. The contents of this variable is only
321 used the first time modules is invoked.
322
323 _MODULESBEGINENV_
324 The filename of the file containing the initialization
325 environment snapshot.
326
327
329 /usr/share/Modules
330 The MODULESHOME directory.
331
332 ${MODULESHOME}/etc/rc
333 The system-wide modules rc file. The location of this file can
334 be changed using the MODULERCFILE environment variable as
335 described above.
336
337 ${HOME}/.modulerc
338 The user specific modules rc file.
339
340 ${MODULESHOME}/modulefiles
341 The directory for system-wide modulefiles. The location of the
342 directory can be changed using the MODULEPATH environment
343 variable as described above.
344
345 ${MODULESHOME}/bin/modulecmd
346 The modulefile interpreter that gets executed upon each
347 invocation of module.
348
349 ${MODULESHOME}/init/<shell>
350 The Modules package initialization file sourced into the user's
351 environment.
352
353 ${MODULEPATH}/.moduleavailcache
354 File containing the cached list of all modulefiles for each
355 directory in the MODULEPATH (only when the avail cache is
356 enabled via the configure option --enable-cache which sets
357 CACHE_AVAIL).
358
359 ${MODULEPATH}/.moduleavailcachedir
360 File containing the names and modification times for all sub-
361 directories with an avail cache (see above).
362
363 ${HOME}/.modulesbeginenv
364 A snapshot of the user's environment taken at Module
365 initialization. This information is used by the module update
366 sub-command (if BEGINENV=1), else
367
368 $MODULESBEGINENV
369 If this defines a valid filename, it serves the same purpose as
370 above (if BEGINENV=99).
371
373 3.2.10
374
376 modulefile(4)
377
378
379
380Modules version 3.2.10 July 2009 MODULE(1)