MODULE(1)
π¦ MODULE(1) β command interface to the Modules package π¦
πΈ NAME πΈ
module β the command interface to the Modules package. Thatβs the whole mood, bestie. π
β¨ SYNOPSIS β¨
module [ switches ] [ sub-command ] [ sub-command-args ]
π DESCRIPTION π
Okay so module is your user interface to the Modules package, and the Modules package is the thing that provides for the dynamic modification of the userβs environment via modulefiles. Itβs giving βshell glow-up on demand.β β¨
Each modulefile contains the information needed to configure the shell for an application. Once the Modules package is initialized, the environment can be modified on a per-module basis using the module command, which interprets modulefiles. Typically modulefiles tell module to alter or set shell environment variables such as PATH, MANPATH, etc. modulefiles may be shared by many users on a system, and users may have their own collection to supplement or replace the shared modulefiles. π«Ά
The modulefiles are added to and removed from the current environment by the user. The environment changes contained in a modulefile can also be summarized through the module command. If no arguments are given, a summary of the module usage and sub-commands is shown. No cap. π
The action for the module command to take is described by the sub-command and its associated arguments. Periodt.
π§ Package Initialization π§
The Modules package and the module command are initialized when a shell-specific initialization script is sourced into the shell. The script creates the module command β either as an alias or shell function β creates Modules environment variables, and if enabled to do so, a snapshot of the environment is saved as either (if BEGINENV=1) $HOME/.modulesbeginenv or (if BEGINENV=99) whatever $MODULESBEGINENV points to. Slay. π
The module alias or function executes the modulecmd program and has the shell evaluate the commandβs output. The first argument to modulecmd specifies the type of shell. iykyk.
The initialization scripts are kept in $MODULESHOME/init/<shell> where <shell> is the name of the sourcing shell. The sh, csh, tcsh, bash, ksh, and zsh shells are supported by modulecmd. In addition, python, perl, and cmake βshellsβ are supported, which writes the environment changes to stdout as python, perl, or cmake code. Iconic behavior. π
The perl module command is set up with:
use lib $ENV{'MODULESHOME'}."/init";
use perl;
And the python module command is defined with:
import os, sys;
sys.path.insert(0, '@INITPATH@')
from python import module;
π₯ Modulecmd startup π₯
Upon invocation, modulecmd sources rc files which contain global, user and modulefile specific setups. These files are interpreted as modulefiles. See modulefile(4) for detailed information. iykyk, bestie. β
Upon invocation of modulecmd, module RC files are sourced in the following order:
- Global RC file as specified by
${MODULERCFILE}or${MODULESHOME}/etc/rc - User specific module RC file
${HOME}/.modulerc - All
.modulercand.versionfiles found during modulefile seeking.
π Command line switches π
The module command accepts command line switches as its first parameter. These may be used to control the output format of all information displayed and the module behavior in case of locating and interpreting module files. Vibe check: these switches can really change the output. β¨
All switches may be entered either in short or long notation. The following switches are accepted:
--help,-Hβ gives some helpful usage information, and terminates the command.--version,-Vβ lists the current version of themodulecommand, and some configured option values. The command then terminates without further processing.--force,-fβ force active dependency resolution. This will result in modules found on aprereqcommand inside a module file being loaded automatically. Unloading module files using this switch will result in all required modules which have been loaded automatically using the-fswitch being unloaded. This switch is experimental at the moment.
β οΈ ngl,--force,-fis experimental rn. Treat it like a beta feature, bestie.
--terse,-tβ displayavailandlistoutput in short format. Lowkey the βkeep it cuteβ option.--long,-lβ displayavailandlistoutput in long format. Highkey the βgive me the loreβ option.--human,-hβ display short output of theavailandlistcommands in human readable format.--verbose,-vβ enable verbose messages duringmodulecommand execution.--silent,-sβ disable verbose messages. Redirect stderr to/dev/nullif stderr is found not to be a tty. This is a useful option for module commands being written into.cshrc,.login, or.profilefiles, because some remote shells (asrsh(1)) and remote execution commands (likerdist) get confused if there is output on stderr. The way that-sprotects your stderr from chaos is iconic. π--create,-cβ create caches formodule availandmodule apropos. You must be granted write access to the${MODULEHOME}/modulefiles/directory if you try to invokemodulewith the-coption.
π Heads up:-cmeans you need write access to${MODULEHOME}/modulefiles/. No write access? No cache magic.
--icase,-iβ case insensitive module parameter evaluation. Currently only implemented for themodule aproposcommand.--userlvl <lvl>,-u <lvl>β set the user level to the specified value. The argument of this option may be one of:novice,novβ Noviceexpert,expβ Experienced module useradvanced,advβ Advanced module user
π Module Sub-Commands π
Main character energy only. Hereβs the sub-command lineup:
help [modulefile...]β print the usage of each sub-command. If an argument is given, print the Module-specific help information for the modulefile(s).add modulefile...,load modulefile...β load modulefile(s) into the shell environment. π«Άrm modulefile...,unload modulefile...β remove modulefile(s) from the shell environment.swap [modulefile1] modulefile2,switch [modulefile1] modulefile2β switch loadedmodulefile1withmodulefile2. Ifmodulefile1is not specified, then it is assumed to be the currently loaded module with the same root name asmodulefile2.show modulefile...,display modulefile...β display information about one or more modulefiles. Thedisplaysub-command will list the full path of the modulefile(s) and all (or most) of the environment changes the modulefile(s) will make if loaded. (It will not display any environment changes found within conditional statements.)listβ list loaded modules.avail [path...]β list all available modulefiles in the currentMODULEPATH, where the sorting order is given by theLC_COLLATElocale environment variable.
All directories in the MODULEPATH are recursively searched for files containing the modulefile magic cookie. π
If an argument is given, then each directory in the MODULEPATH is searched for modulefiles whose pathname match the argument.
Multiple versions of an application can be supported by creating a subdirectory for the application containing modulefiles for each version. Obsessed with this versioning moment.
use [-a|--append] directory...β prepend one or more directories to theMODULEPATHenvironment variable. The--appendflag will append the directory toMODULEPATH.unuse directory...β remove one or more directories from theMODULEPATHenvironment variable.updateβ attempt to reload all loaded modulefiles. The environment will be reconfigured to match the environment saved in${HOME}/.modulesbeginenv(ifBEGINENV=1) or the file pointed at by$MODULESBEGINEV(ifBEGINENV=99) and the modulefiles will be reloaded. This is only valid if modules was configured with--enable-beginenv(which definesBEGINENV), otherwise this will cause a warning.updatewill only change the environment variables that the modulefiles set.
β οΈupdateonly works if modules was configured with--enable-beginenv(which definesBEGINENV). Otherwise: warning town. Periodt.
clearβ force the Modules package to believe that no modules are currently loaded. Not me being dramatic aboutclearβ it just forces the Modules package to believe nothing is loaded.purgeβ unload all loaded modulefiles. Bye bestie. πrefreshβ force a refresh of all non-persistent components of currently loaded modules. This should be used on derived shells where aliases need to be reinitialized but the environment variables have already been set by the currently loaded modules.whatis [modulefile...]β display the information set up by themodule-whatiscommands inside the specified modulefile(s). If no modulefile is specified, all'whatis'lines will be shown.apropos string,keyword stringβ seeks through the'whatis'informations of all modulefiles for the specified string. Allmodule-whatisinformations matching the string will be displayed.initadd modulefile...β add modulefile(s) to the shellβs initialization file in the userβs home directory. The startup files checked (in order) are:cshβ.modules,.cshrc(.ext),.csh_variables, and.login(.ext)tcshβ.modules,.tcshrc,.cshrc(.ext),.csh_variables, and.login(.ext)shandkshβ.modules,.profile(.ext), and.kshenv(.ext)bashβ.modules,.bash_profile,.bash_login,.profile(.ext), and.bashrc(.ext)zshβ.modules,.zcshrc(.ext),.zshenv(.ext), and.zlogin(.ext)
initadd(cont.) β if amodule loadline is found in any of these files, the modulefile(s) is(are) appended to any existing list of modulefiles. Thatmodule loadline must live in at least one of the files listed above for any of theinitsub-commands to work properly. And if themodule loadline shows up in multiple shell initialization files? All of the lines get changed. πinitprependmodulefile [modulefile...] β same asinitaddbut it prepends the given modules to the beginning of the list.initrmmodulefile... β removes modulefile(s) from the shell's initialization files.initswitchmodulefile1 modulefile2 β switches modulefile1 with modulefile2 in the shell's initialization files. πinitlistβ lists all of the modulefiles loaded from the shell's initialization file.initclearβ clears all of the modulefiles from the shell's initialization files. poof, gone π«§
π¦ Modulefiles π¦
okay so modulefiles are written in the Tool Command Language (Tcl) and they get interpreted by modulecmd. They can use conditional statements, which is honestly so cool β meaning the effect a modulefile has on the environment may change depending on the current state of the environment. it's giving sentient π
β οΈ heads up bestie: environment variables are unset when unloading a modulefile. So yes, you can load a modulefile and then unload it, and the environment variables will not return to their prior state. no cap, that's just how it is.
π ENVIRONMENT π
MODULESHOMEβ the location of the master Modules package file directory. It contains themodulecommand initialization scripts, the executable programmodulecmd, and a directory holding a collection of master modulefiles. πMODULEPATHβ the path that themodulecommand searches when it's looking for modulefiles. Typically it's set to a default value by the bootstrap procedure.MODULEPATHcan be set usingmodule use, or by the module initialization script, to search group or personal modulefile directories before or after the master modulefile directory. πLOADEDMODULESβ a colon separated list of all loaded modulefiles._LMFILES_β a colon separated list of the full pathname for all loaded modulefiles.MODULESBEGINENVβ if modules has been configured (BEGINENV=99) to test for this environment variable, then if it exists, it is the name of the file to store the initial shell environment. This environment variable will have embedded environment variables unrolled to one level. The contents of this variable is only used the first time modules is invoked. β°_MODULESBEGINENV_β the filename of the file containing the initialization environment snapshot.
π FILES π
/usr/Modulesβ theMODULESHOMEdirectory.${MODULESHOME}/etc/rcβ the system-wide modules rc file. The location of this file can be changed using theMODULERCFILEenvironment variable as described above. β¨${HOME}/.modulercβ the user specific modules rc file.${MODULESHOME}/modulefilesβ the directory for system-wide modulefiles. The location of the directory can be changed using theMODULEPATHenvironment variable as described above.${MODULESHOME}/bin/modulecmdβ the modulefile interpreter that gets executed upon each invocation ofmodule. βοΈ${MODULESHOME}/init/<shell>β the Modules package initialization file sourced into the user's environment.${MODULEPATH}/.moduleavailcacheβ file containing the cached list of all modulefiles for each directory in theMODULEPATH(only when the avail cache is enabled via the configure option--enable-cache, which setsCACHE_AVAIL).${MODULEPATH}/.moduleavailcachedirβ file containing the names and modification times for all sub-directories with an avail cache (see above).${HOME}/.modulesbeginenvβ a snapshot of the user's environment taken at Module initialization. This information is used by themodule updatesub-command (ifBEGINENV=1), elseβ¦$MODULESBEGINENVβ if this defines a valid filename, it serves the same purpose as above (ifBEGINENV=99). π«Ά
β VERSION β
3.2.13
π SEE ALSO π
modulefile(4) β go read it, iykyk π
and that's the whole thing, bestie! this lil masterpiece is Modules version 3.2.13, dated 2020-04-07 β a vintage icon honestly, we stan a classic ππβ¨
π¦ where this page comes from
- opensuse-leap 16.0: Modules 4.8.0-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: Modules 4.8.0-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: Modules 4.8.0-160000.2.2 Β· GPL-2.0-or-later
- opensuse-leap 16.0: Modules 4.8.0-160000.2.2 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms