Ping TCP ports using tcping. Inspired by Linux's ping utility. Written in Go
Ping TCP ports using tcping. Inspired by Linux's ping utility. Written in Go
[!CAUTION] This is a work in progress branch, not the main one.
A cross-platform ping program using TCP, UDP or HTTP(S) instead of ICMP, inspired by Linux's ping utility.
[!TIP] This document is also available in 中文.
ping where ICMP is blocked, probing over TCP, HTTP(S) or UDP.ping does, plus the longest uptime and downtime and when they happened.Enter key, without stopping the program.HTTP(S) probe.-r) or before every probe (--resolve-every-probe), and reports how long each lookup took. Suitable to test your DNS load balancing or Global Server Load Balancer (GSLB).IPv4 or IPv6.Check out the demos to get a look and feel of tcping.
Click to expand
-D -4) flags--no-color --no-stats) flags-r) flag-j --pretty) flag--json-url --json-server) flags--resolve-every-probe) flag-I) flag-v) flag--insecure) flag--udp-server) flag--failures-only) flag| Platform | Install with |
|---|---|
| Windows | winget install pj.tcping |
| macOS | brew install pouriyajamshidi/tap/tcping |
| Debian, Ubuntu | sudo apt install tcping, after adding the repository |
| Fedora, RHEL, CentOS | sudo dnf install tcping, after adding the repository |
| Alpine | sudo apk add tcping, after adding the repository |
| Arch, Manjaro | yay -S tcping-bin |
| Any Linux | a one-line install or a package file |
| BSD | the prebuilt binary |
| Nix | nix profile install github:pouriyajamshidi/tcping |
| Docker | docker run -it pouriyajamshidi/tcping example.com 443 |
| Go | go install github.com/pouriyajamshidi/tcping/v3@latest |
The binaries are static, meaning they carry everything they need inside one file and do not depend on any library being present on your machine. They live on the release page, for amd64 and arm64.
Once you are done with the installation, head to the usage section.
The best way to install tcping on Windows is through Windows Package Manager by utilizing WinGet, which is available on practically all Windows 10 and 11 machines by default since September of 2020:
winget install pj.tcpingTo install it by hand instead, extract the downloaded zip file and copy tcping.exe to your system PATH like C:\Windows\System32.
[!CAUTION] TCPING might falsely get flagged by Windows Defender or some anti-malware software. This is common among Go programs. Check out the official statement from the Go team here.
[!WARNING] The
--sqlite(sqlite3) output format is not available on Windows binaries anymore. All the other flags work as expected.
brew install pouriyajamshidi/tap/tcpingPaste the following in your terminal to grab the latest binary for your architecture and install it:
cd /tmp &&
ARCH=$(uname -m | sed 's/x86_64/amd64/; s/aarch64/arm64/') &&
curl -LO "https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping-linux-$ARCH.tar.gz" &&
tar -xf "tcping-linux-$ARCH.tar.gz" &&
sudo install tcping /usr/local/bin/ &&
sudo install -Dm 644 completions/tcping.bash /usr/share/bash-completion/completions/tcping &&
sudo install -Dm 644 completions/_tcping /usr/share/zsh/site-functions/_tcping &&
sudo install -Dm 644 completions/tcping.fish /usr/share/fish/vendor_completions.d/tcping.fish &&
tcping --versionThe last three lines install the shell completions. Drop the ones for the shells you do not use, and start a new shell to pick them up.
If you don't have curl, swap its line for wget:
wget "https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping-linux-$ARCH.tar.gz" &&Adding the repository once means apt, dnf or apk handles installs and
upgrades from then on, like any other package.
Debian, Ubuntu and their flavors:
sudo install -d /etc/apt/keyrings &&
sudo curl -fsSL https://pouriyajamshidi.github.io/packages/keys/pouriyajamshidi.gpg -o /etc/apt/keyrings/pouriyajamshidi.gpg &&
echo "deb [signed-by=/etc/apt/keyrings/pouriyajamshidi.gpg] https://pouriyajamshidi.github.io/packages/deb ./" | sudo tee /etc/apt/sources.list.d/pouriyajamshidi.list &&
sudo apt update &&
sudo apt install tcpingFedora, RHEL, CentOS and their flavors:
sudo curl -fsSL https://pouriyajamshidi.github.io/packages/rpm/pouriyajamshidi.repo -o /etc/yum.repos.d/pouriyajamshidi.repo &&
sudo dnf install tcpingAlpine:
sudo curl -fsSL https://pouriyajamshidi.github.io/packages/keys/pouriyajamshidi.rsa.pub -o /etc/apk/keys/pouriyajamshidi.rsa.pub &&
echo "https://pouriyajamshidi.github.io/packages/apk" | sudo tee -a /etc/apk/repositories &&
sudo apk update &&
sudo apk add tcpingArch, Manjaro, EndeavourOS and their flavors have it on the AUR, so use your favorite helper:
yay -S tcping-binWithout adding a repository, download the package for your distro from the release page and install it:
| Distro | Package | Install |
|---|---|---|
| Debian, Ubuntu | tcping-amd64.deb |
sudo apt install -y ./tcping-amd64.deb |
| Fedora, RHEL, CentOS | tcping-amd64.rpm |
sudo dnf install -y ./tcping-amd64.rpm |
| Arch, Manjaro | tcping-amd64.pkg.tar.zst |
sudo pacman -U ./tcping-amd64.pkg.tar.zst |
| Alpine | tcping-amd64.apk |
sudo apk add --allow-untrusted ./tcping-amd64.apk |
Swap amd64 for arm64 on ARM machines. All four install the binary and the
shell completions for you. Machines without dnf can use
yum instead, and Alpine needs --allow-untrusted because our packages are not
signed with an Alpine key.
Download the file for your respective OS and architecture:
wget https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping-freebsd-amd64.tar.gz
# Or for Linux ARM64 machines and using cURL
curl -LO https://github.com/pouriyajamshidi/tcping/releases/latest/download/tcping-linux-arm64.tar.gzExtract it and copy the executable to your system PATH like /usr/local/bin/:
tar -xvf tcping-freebsd-amd64.tar.gz &&
chmod +x tcping &&
sudo cp tcping /usr/local/bin/The archive also carries a completions folder. See Shell Completions to install them.
tcping ships a flake, so on any machine that has Nix you can run it without installing anything:
nix run github:pouriyajamshidi/tcping -- example.com 80Or install it for good:
nix profile install github:pouriyajamshidi/tcpingBoth give you the binary and the shell completions. The
flake also has a devShells.default with everything needed to work on tcping,
which you get with nix develop.
Docker images:
docker pull pouriyajamshidi/tcping:latest
# Or
docker pull ghcr.io/pouriyajamshidi/tcping:latestUsing go install:
This requires at least go version
1.26.8
go install github.com/pouriyajamshidi/tcping/v3@latestDirectly without installation in x-cmd.
x tcping example.com 80Or install tcping locally using x-cmd, without needing root privileges or affecting your global setup.
x env use tcping
tcping example.com 80Finally, you can compile the code yourself by running the make command:
make buildThis will place the executables in the output folder.
Completion scripts for bash, zsh, fish and PowerShell live in the
completions folder. They complete the flags, the interface names
for -I and the file names for --csv and --sqlite.
The Linux packages and the one-line install put them in place for you. The release archives ship them next to the binary, so they can also be installed from there with the commands below.
bash:
sudo install -Dm 644 completions/tcping.bash /usr/share/bash-completion/completions/tcpingzsh:
sudo install -Dm 644 completions/_tcping /usr/share/zsh/site-functions/_tcpingfish:
install -Dm 644 completions/tcping.fish ~/.config/fish/completions/tcping.fishPowerShell, by dot-sourcing the script from your profile:
Add-Content $PROFILE ". C:\path\to\tcping.ps1"Start a new shell afterwards to pick them up.
Give tcping a target and a port, and it starts probing:
tcping www.example.com 443
tcping www.example.com:443 # host:port works too
tcping 192.168.1.1:80
tcping '[2001:db8::1]:443' # quoted, so the shell leaves it alone
tcping https://www.example.com # probed over HTTP(S)
tcping udp://127.0.0.1 53 # probed over UDPSome of the things you can ask of a run:
tcping www.example.com 443 -c 5 # stop after 5 probes
tcping www.example.com 443 -i 2 -t 5 # 2 seconds between probes, 5 seconds timeout
tcping www.example.com 443 -I eth2 # send the probes from a given interface
tcping www.example.com 443 -4 # or -6, to enforce an address family
tcping www.example.com 443 -D # show a timestamp for each probe
tcping www.example.com 443 -r 5 # resolve the hostname again after 5 failuresAnd the output formats it can produce, instead of th
No open issues yet, or sync has not completed.