When installing software on an High Performance Computing unit, additional packages are often handled by the module package.
To have a list of all the modules available it is sufficient to type
module avail
Often one then retrieves a very long list of possible modules, in alphabetic order. This is not very convenient if one is looking for a particular feature and dos not really know how it has been categorised.
One may think that grep would suffice to filter the results. This is almost true: in order to use grep first one needs to reformat the result of module avail with the -t option into a single column, redirect the standard error output (labelled by 2 in Bash) to the standard output (labelled by 1, so that the redirection is 2>&1) and then pipe it with grep.
For example, if we want to search for all the modules containing “python” in their name we would type:
module avail -t 2>&1 | grep -i python
and eventually just write a convenient script named modsearch in our ~/bin :
#!/bin/bash
module avail -t 2>&1 | grep -i $1
so that in the future we will just have to type
modsearch python