Vyga Vyga - 1 year ago 56
Bash Question

Sometimes I'd like to know what my shells aliases/functions are before I execute them. Can I log them without executing them?

I'm not sure if this is a stupid question but I'll often run into the sinario were I don't know what my commands are set to are without having to open my

(I'm using zsh obviously).

For instance lets use
. I'm not sure which of the following
will execute:

alias gs="git status"

alias gs="gulp serve"

alias gs="grunt serve"

Is there a command, or something like
echo gs
echo "$(gs)"
that will log the command (e.g.
git status
) rather executing what ever I have
set to?

Answer Source

You can run the alias command to print out all of your shell aliases. If you want to know what a particular alias resolves to, just pass it to the alias command as an argument:

➜  alias gs
gs='git status'
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download