Vyga Vyga - 15 days ago 5
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

.zshrc
(I'm using zsh obviously).

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

alias gs="git status"


or
alias gs="gulp serve"


or
alias gs="grunt serve"


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

Answer

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'
Comments