To simply view the output of the previous executed command, you can run the following echo:
~$ echo "$?"
Indeed, $?
returns the output code or message of the last executed command. Below a common example:
~$ touch foobar ~$ rm foobar ~$ echo "$?" 0
~$ rm foobar rm: cannot remove 'foobar': No such file or directory ~$ echo "$?" 1
A value of 0
means “Success”, while a value of 1
means “Fail”.