How to check if the last command was successful in Unix?

echo $?

Category: UNIX Interview Questions.