How do you display detailed information about the last command executed?

Study for the Linux Fundamentals Test. Enhance your skills with flashcards and multiple-choice questions. Each question has hints and explanations. Get ready for your exam!

To display detailed information about the last command executed, the option to use is echo $?. This command outputs the exit status of the last executed command. In Linux, every command returns an exit status code upon completion, where a code of "0" typically indicates success, and any non-zero code indicates an error or a different type of exit status. By using echo $?, users can gain insight into what happened with the previous command, making it a valuable tool for troubleshooting and verification of command execution.

The other options do not provide detailed information in the same way. The command !! allows you to execute the last command again but does not give information about it. The syntax !n executes the nth command from the history, which also does not provide information about its execution status. Lastly, history -d is used to delete a specific entry from the command history, not to display information about the last executed command. Therefore, echo $? is the most appropriate choice for obtaining detailed information about the last command executed.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy