If something weird is happening, you want to know everything that's going on on a server, as fast as possible.

At these times, you will be very happy to have a simple alias wtf installed that you can type immediately after logging into a server, and see all that it's busy with.

tldr; oneliner (okay, three-liner)

$ [ -z "$(fgrep 'alias wtf' ~/.bash_aliases)" ] \
  && echo "alias wtf='tail -f /var/log/{dmesg,messages,*{,/*}{log,err}}'" \
  >> ~/.bash_aliases && . ~/.bash_aliases

Explained

Normally you could type

$ tail -f /var/log/messages
$ tail -f /var/log/syslog
$ tail -f /var/log/mysql/error.log
$ tail -f /var/log/nginx/php-errors.log
$ # etc

But you can have all this goodness in one command:

$ tail -f /var/log/{dmesg,messages,*{,/*}{log,err}}

Now this is slightly hard to type, so we'll save it in an alias:

$ alias wtf='[...]'

Cool. You can now just type wtf.

However next time you login, the alias is lost. To make it persist, we store it in your ~/.bash_aliases. This file gets sourced everytime you log into bash (if you use zsh, you will know what to do):

$ echo "[...]" >> ~/.bash_aliases

But this only stores the alias for your next logins. To make your current session profit, we source it now:

$ . ~/.bash_aliases

One more thing, you should just be able to copy paste this, without the alias getting added twice, so we make sure it does not exist yet:

$ [ -z "$(fgrep 'alias wtf' ~/.bash_aliases)" ]

(directly using fgrep here could cause an exit 1 if ~/.bash_aliases does not exist yet, in which case we still want to continue, so we check with -z instead)

And we put all this together as shown above in the oneliner, and we can start using wtf directly.

On a Mac?

Add the following to your ~/.bash_profile

if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi

Courtesy of @dogmatic and myself

:)