I'm working with Virtualenv, which I found out (after a few google searches) that it creates a shell function called deactivate in my shell.

By looking through the package's files I found how it does that, but I was curious if there's a command similar to which which could have told me more about the shell function without me having to grep through files.

So the which asdf command tells me the path where the executable asdf is found. which however gives no output for shell functions. Is there a similar command that displays the function's code, or source file, or something of this sort?

Bonus: I'd highly appreciate some command to list the available shell functions.


set shows you all available shell functions.

I don't believe there's a way to figure out where a function was set historically, because I don't think the shell stores this information.

You might find set -x helpful to watch execution as it happens.

  • And aparently, the zsh set does things a little differently than tha bash set. For one, i could find my deactivate function with the bash set, but not with the zsh one. – vlad-ardelean Sep 23 '14 at 18:50
  • In zsh, the command functions lists the functions. – Ralph Rönnquist Jan 12 '16 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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