Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Consider the following:

$ module
cmdModule.c(166):ERROR:11: Usage is 'module command  [arguments ...] '

  Modules Release 3.2.6 2007-02-14 (Copyright GNU GPL v2 1991):

  Usage: module [ switches ] [ subcommand ] [subcommand-args ]

Switches:
(...omissis...)

$ which module
no module in (...long list of my path)

$ alias
alias cp='cp -i'
alias h='history | grep '
alias ls='/usr/local/bin/ls --color=always'
alias mv='mv -i'
alias rm='rm -i'
alias vi='vim'

$

Clearly, the module command is there and is available to execute, but I can't find it (easily). Digging a little bit, I found it on the system, and I noticed that it's an alias to

bin/modulecmd $SHELL

in module installation path.

But why it doesn't appear in the alias list and why - even if it doesn't appear - it work?

share|improve this question

2 Answers 2

Edit: I wonder if something tricky is being done in the alias. Try this:

alias|hd


Edit 2:

The reason I suggested the above is that it's possible to hide aliases. See my question and answer here for details.


Original answer:

Try type -a module it's more comprehensive.

Also, if it's a function, you can see its definition using this:

declare -f module

and you would need to grep these files, plus any that they source, plus any that I left out, to find where it's defined:

  • /etc/profile
  • /etc/bash.bashrc
  • ~/.profile
  • ~/.bashrc
  • ~/.bash_profile
  • ~/.bash_login
share|improve this answer
    
Thanks, type is what I was looking for, but it doesn't work for all the shells (the same is true for declare - both are shell builtins). Note that I didn't tag bash, but shell! Both are unavailable in csh, thus I'm just upvoting and not accepting. The list of files you suggested to grep, implies that you believe I'm on a much simpler system than I really am (the list of relevant dotfiles would be at least ten time longer) –  Davide Oct 22 '09 at 19:22
    
See my edited answer. I'm sorry I missed that "module" was the real name. There are a few things in your question that make it look "sanitized". And I did say "plus any that I left out". Anyway, thanks for the +1. –  Dennis Williamson Oct 22 '09 at 21:06

It's a function.

And it comes from here. It's quite convenient to manage environment variables.

share|improve this answer
    
Yes, I perfectly know what module is and where it comes from (although I didn't say so in the question - my bad). I was just wondering why "something" didn't appear neither in "whereis" nor in "alias" –  Davide Oct 22 '09 at 19:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.