What are the exit statuses of ssh command?
SSH client is a program for logging into a remote machine and for executing commands on a remote machine. By default in Linux/UNIX if particular command/shell script is executed, it return two type of values which is used to see whether command or shell script executed is successful or not. This value is know as Exit Status of shell command or script.
The session terminates when the command or shell on the remote machine exits and all X11 and TCP/IP connections have been closed. The exit status of the remote program is returned as the exit status of ssh. You can use bash shell $? Variable to print exit status of shell. For example:
user@localhost: $ ssh user@somewhere.com
Password:
user@somewhere.com: $ exit
user@localhost: $ echo $?
In short,
- ssh exits with the exit status of the remote command which can be find with echo $? command.
- Or value 255 is return, if an error occurred while processing request via ssh session
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Shell: How to determine the exit status of Linux and UNIX command
- I2O block arrays trouble - Linux fails to install GRUB at the end of successful installation
- Perl display and pass command ling arguments with @argv
- Linux: How do I find out causes for memory faults?
- Can I run fsck or e2fsck when Linux file system is mounted?
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!


Recent Comments
Yesterday ~ 7 Comments
Yesterday ~ 33 Comments
Yesterday ~ 2 Comments
Yesterday ~ 1 Comment
Yesterday ~ 2 Comments