How to find the return value of last executed command in UNIX? December 24, 2023 by Tarik You can use the shell variable $? Such as: $ true ; echo $? 0 $ false ; echo $? 1