SSH-PING(1)
π SSH-PING π
okay bestie, welcome to the ssh-ping(1) page β it lives in the User Commands section of the manual, and it's genuinely the cutest little tool. it checks if a host is reachable, but it does it using your ssh_config, which is lowkey iconic of it. let's go π¦
β¨ NAME β¨
ssh-ping β check if host is reachable using ssh_config π
β¨ SYNOPSIS β¨
ssh-ping [OPTIONS] [user@]hostname
that's it. that's the whole vibe. options go first, then the host, and the [user@] part is optional because sometimes you just wanna let the config do its thing, periodt.
β¨ DESCRIPTION β¨
check if host is reachable using ssh_config.
like. that's the whole job. it's a ping but make it ssh. no cap. π₯
β¨ OPTIONS β¨
okay this is the part where I need you to lock in, because there are a LOT of these and every single one matters. no skimming, bestie π«Ά
-4β IPv4 only. old reliable energy.-6β IPv6 only. futuristic queen behavior.-ccount β stop after sending count request packets. so like,-c 1means one and done, know your limits π-Cβ connect as soon as the host responds, and try reconnecting after a SSH session ends (e.g. rebooting). useful also for IDRAC, IPMI, ILO devices, Switches, etc... which don't have a full shell environment.CTRL+Cstops reconnect attempts. this one is persistent and a little obsessive but we respect it π-Eβ exit immediately after first successful ping (can be used to trigger a follow up task likersync). this is the "ok you're up, let's GO" flag fr fr.-Fconfigfile β specifies an alternative per-user configuration file. if a configuration file is given on the command line, the system-wide configuration file (/etc/ssh/ssh_config) will be ignored. the default for the per-user configuration file is~/.ssh/config. so like, choose your own adventure, but know that picking one means the system one is out of the group chat π-hβ show this message. hi, hello, help is here π-iinterval β wait interval seconds between sending each request. the default is1second. patience is a virtue or whatever β¨-luser β try login with user as username. the default is the current value of$USER. main character energy, literally.-Dβ print timestamp (unix time + microseconds as ingettimeofday) before each line. nerdy and precise, we love her π§-Hβ print timestamp (human readable) before each line. same but for people who don't read raw microseconds at brunch πΈ-Wtimeout β time to wait for a response, in seconds. don't wait forever, bestie, it's not that serious π-pport β port to connect to on the remote host. this can be specified on a per-host basis in the configuration file. versatile icon π-qβ quiet output. nothing is displayed except the summary lines at startup time and when finished. the strong silent type. π€«-nβ no colors. (e.g. for black on white terminals). respectfully, monochrome moment π€-vβ verbose output. tell me EVERYTHING. give me the lore. π£οΈ--versionβ show version information. who are you, where did you come from, what's your sign π
β¨ TAB_COMPLETIONS β¨
Ubuntu (and maybe other distros) already ship shell completions for ssh which can be used. so you don't even have to type the whole hostname like a peasant, slay π
- Bash β
complete -F _known_hosts ssh-ping - Zsh β
compdef _ssh_hosts ssh-ping - Fish β
complete -c ssh-ping -a "(__fish_print_hostnames)"
β¨ ENVIRONMENT β¨
SSH_PING_NO_COLORSβ if set, no colors are shown (like-n). it's giving "I said what I said" π
β¨ EXIT_CODES β¨
okay these are important because scripts LIVE and DIE by these. pay attention bestie π
0β no requests lost. perfect. flawless. ate. β¨1β more than 1 request lost. hmm. something's up. π2β all requests lost. it's giving ghosted. absolutely nobody home. π
β¨ EXAMPLES β¨
here's the good stuff, copy these and go be great π«Ά
ssh-ping -E hostname && echo "First successful ping. Starting rsync..."
ssh-ping -q -c 1 hostname >/dev/null && echo "Host is up!"
ssh-ping -q -c 1 hostname >/dev/null || echo "Host is down!"
SSH_PING_NO_COLORS=true ssh-ping -c 1 hostname
the && one is for when it's up, the || one is for when it's not, and the last one is for when you simply cannot with colors today. iconic scripting behavior, no notes π
πΈ SEE ALSO πΈ
hmm, there's no SEE ALSO section in this one bestie, it's a short and sweet little page. we keep it exactly as it is β no invented references, that's the rule π
okay that's the whole page!! this one comes to you from the SSH-TOOLS collection, dated March 2024 π go forth and ping your hosts, bestie. bye!! π¦β¨π
π¦ where this page comes from
- arch rolling: ssh-tools 1.10-1 Β· GPL-3.0-only
- debian trixie: ssh-tools 1.9-1+b6 Β· GPL-3.0-or-later
- ubuntu questing: ssh-tools 1.9-1
- ubuntu resolute: ssh-tools 1.9-1build1 Β· GPL-3.0-or-later
- ubuntu stonking: ssh-tools 1.9-2 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms