.TH SSH-PING "1" "March 2024" "SSH-TOOLS" "User Commands" .SH NAME ssh-ping .SH SYNOPSIS ssh\-ping [OPTIONS] [user@]hostname .SH DESCRIPTION check if host is reachable using ssh_config .SH OPTIONS .TP \fB\-4\fR Use IPv4 only .TP \fB\-6\fR Use IPv6 only .TP \fB\-c\fR count Stop after sending request packets .TP \fB\-C\fR Connect as soon as the host responds .br and try reconnecting after a SSH session ends (e.g. rebooting). .br Useful also for IDRAC, IPMI, ILO devices, Switches, etc... .br which don't have a full shell environment. .br CTRL+C stops reconnect attempts. .TP \fB\-E\fR Exit immediately after first successful ping .br (can be used to trigger a follow up task like rsync) .TP \fB\-F\fR configfile Specifies an alternative per\-user configuration file. .br If a configuration file is given on the command line, .br the system\-wide configuration file ( \fI\,/etc/ssh/ssh_config\/\fP ) will be ignored. .br The default for the per\-user configuration file is ~/.ssh/config. .TP \fB\-h\fR Show this message .TP \fB\-i\fR interval Wait seconds between sending each request. .br The default is 1 second. .TP \fB\-l\fR user Try login with as username. The default is the current value of $USER. .TP \fB\-D\fR Print timestamp (unix time + microseconds as in gettimeofday) before each line .TP \fB\-H\fR Print timestamp (human readable) before each line .TP \fB\-W\fR timeout Time to wait for a response, in seconds .TP \fB\-p\fR port Port to connect to on the remote host. .br This can be specified on a per\-host basis in the configuration file. .TP \fB\-q\fR Quiet output. .br Nothing is displayed except the summary lines at startup time and when finished .TP \fB\-n\fR No colors. .br (e.g. for black on white terminals) .TP \fB\-v\fR Verbose output .TP \fB\--version\fR show version information .SH TAB_COMPLETIONS Ubuntu (and maybe other distros) already ship .br shell completions for ssh which can be used: .TP \fBBash\fR complete \fB\-F\fR _known_hosts ssh\-ping .TP \fBZsh\fR compdef _ssh_hosts ssh\-ping .TP \fBFish\fR complete \fB\-c\fR ssh\-ping \fB\-a\fR "(__fish_print_hostnames)" .SH ENVIRONMENT .TP SSH_PING_NO_COLORS if set, no colors are shown (like \fB\-n\fR) .SH EXIT_CODES .TP 0 No requests lost .TP 1 More than 1 request lost .TP 2 All requests lost .SH EXAMPLES .TP ssh\-ping \fB\-E\fR hostname && echo "First successful ping. Starting rsync..." .TP ssh\-ping \fB\-q\fR \fB\-c\fR 1 hostname >/dev/null && echo "Host is up!" .TP ssh\-ping \fB\-q\fR \fB\-c\fR 1 hostname >/dev/null || echo "Host is down!" .TP SSH_PING_NO_COLORS=true ssh\-ping \fB\-c\fR 1 hostname