Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bping

A small ping utility for Linux that beeps whenever a reply arrives.

64 bytes from 142.250.x.x: icmp_seq=1 ttl=117 time=12.4 ms

Build

make

Produces the bping binary. Requires only a C11 compiler and libc (-lm for the statistics math).

Installation

make
sudo make install

This installs the binary to /usr/local/bin/bping and the man page to /usr/local/share/man/man1/bping.1. To use a different prefix:

sudo make install PREFIX=/usr

To remove it later:

sudo make uninstall

You can also run ./bping straight from the build directory without installing anything.

For sound notifications, install paplay if your system doesn't have it (Debian/Ubuntu: pulseaudio-utils or pipewire-pulse; Fedora: pulseaudio-utils; Arch: libpulse with pipewire-pulse). Without it, bping falls back to beep(1) or the terminal bell.

See Permissions below if you want to run bping without root.

Usage

bping [OPTIONS] HOST
bping google.com
bping -c 10 google.com
bping --beep google.com
bping -i 0.5 -W 2 --beep 192.168.1.1

Options

Option Description
-c, --count N stop after N packets (default: unlimited)
-i, --interval SEC seconds between packets (default: 1.0)
-W, --timeout SEC seconds to wait for each reply (default: 1.0)
-t, --ttl N IP time-to-live, 1-255 (default: system)
-b, --beep beep when a reply is received
-s, --sound FILE play FILE (wav, oga, ...) via paplay; implies --beep
-q, --quiet only print the summary
-v, --verbose verbose output (also shows per-request timeouts)
-h, --help show help
-V, --version show version

Ctrl+C stops the loop and prints the statistics summary, like ping.

Sound

With --beep, bping picks the best available notification backend:

  1. paplay playing the freedesktop bell sound (/usr/share/sounds/freedesktop/stereo/bell.oga) — works on PulseAudio/PipeWire systems
  2. the beep(1) utility (PC speaker)
  3. the terminal bell (BEL) as a last resort — your terminal emulator must have the audible/visual bell enabled to hear this one

With --sound FILE, your own sound file is played via paplay instead (WAV, OGA, or any format paplay supports):

bping --sound ~/sounds/ping.wav google.com

--sound implies --beep and fails at startup if the file is unreadable or paplay is not installed.

Run with -v to see which backend was selected (beep backend: ...).

Permissions

bping first tries an unprivileged Linux ICMP "ping" socket (SOCK_DGRAM/IPPROTO_ICMP). This works when the kernel allows it for your user via net.ipv4.ping_group_range, e.g.:

sudo sysctl net.ipv4.ping_group_range="0 2147483647"

If ping sockets are unavailable, bping falls back to a raw socket, which requires root or the CAP_NET_RAW capability:

sudo setcap cap_net_raw+ep bping

Layout

include/   public headers (config, icmp, output, statistics, beep)
src/       implementation, one module per concern

The ICMP engine, statistics, output, and the beeper are deliberately independent so features (IPv6, JSON output, other notifiers) can be added without touching the core loop.

License

GNU Affero General Public License v3.0 (AGPL-3.0), see LICENSE.

About

A small Linux ping utility that beeps whenever a reply arrives (C, ICMP echo with paplay/beep notifications)

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages