Operations 7 min read

How to Install and Use tcpping for TCP‑Based Latency Measurements on Linux

This guide explains why the traditional ping tool may fail behind firewalls, introduces the TCP‑based tcpping utility, details its installation prerequisites (tcptraceroute and bc), shows how to download and set up the script, and provides comprehensive usage options and examples for measuring network RTT.

Liangxu Linux
Liangxu Linux
Liangxu Linux
How to Install and Use tcpping for TCP‑Based Latency Measurements on Linux

Installing tcpping on Linux

tcpping is a shell‑script that sends TCP SYN packets and measures round‑trip time (RTT) using the TCP three‑way handshake. It requires tcptraceroute and bc as prerequisites.

Install prerequisites

Ubuntu/Debian:

sudo apt-get update
sudo apt-get install tcptraceroute bc

CentOS/RHEL:

sudo yum install tcptraceroute bc

Download and install tcpping

wget http://www.vdberg.org/~richard/tcpping
sudo cp tcpping /usr/local/bin/
sudo chmod 755 /usr/local/bin/tcpping

Using tcpping

Basic syntax:

tcpping [-d] [-c] [-r sec] [-x count] ipaddress [port]
-d

: prepend a timestamp to each line. -c: column‑oriented output for easier parsing. -r: interval between probes in seconds (default 1). -x: repeat count times (default unlimited). port: destination TCP port (default 80).

Root privileges are required because the script invokes the privileged tcptraceroute binary.

Example – measuring RTT of a web server

tcpping www.rumenz.com
seq 0: tcp response from 42.194.162.109 (42.194.162.109) <syn,ack> 33.822 ms
seq 1: tcp response from 42.194.162.109 (42.194.162.109) <syn,ack> 33.975 ms
...

Additional utilities

To test whether a remote TCP port is open, you can use nc (netcat):

nc -vn <ip-address> <port-number>

Advanced options

-t

: continuous probing until interrupted (Ctrl+C). -n 5: stop after 5 probes. -w 0.5: set timeout to 0.5 seconds. -4: prefer IPv4 when both A and AAAA records exist. -6: prefer IPv6. --file: read a list of hosts (one per line, optional port) and probe each, e.g.

tcpping --file hosts.txt
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

LinuxNetwork LatencytcppingTCP pingtcptraceroutebc
Liangxu Linux
Written by

Liangxu Linux

Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.