In the Ubuntu system, you can install and use the tcping
tool by following these steps:
1. Install dependencies and tools#
First, you need to install tcptraceroute
and download the tcping
script:
sudo apt update
sudo apt install tcptraceroute
sudo wget http://www.vdberg.org/~richard/tcpping -O /usr/bin/tcping
sudo chmod +x /usr/bin/tcping
2. Basic usage#
Test the connectivity of a specific port on the target host (default port is 80):
tcping example.com 443 # Test the 443 port of example.com
3. Common parameters#
-t
: Continuous testing until manually stopped (Ctrl+C)-n 5
: Send 5 test requests (for example:tcping -n 5 example.com 80
)-i 5
: Set the interval time to 5 seconds (for example:tcping -i 5 example.com 80
)-w 0.5
: Set the timeout to 0.5 seconds (for example:tcping -w 0.5 example.com 80
)-d
: Include date and time in the output-4
/-6
: Force the use of IPv4 or IPv6
4. Example#
Test the 443 port of Baidu, 5 times continuously, with an interval of 2 seconds:
tcping -n 5 -i 2 www.baidu.com 443
Notes#
- If the target server has disabled the ICMP protocol (such as disabling PING),
tcping
can still check the port status via TCP protocol. - Some parameters may vary slightly due to different versions; you can view the complete help by using
tcping -h
.
If you need more detailed output or advanced features such as proxy settings, you can refer to the full documentation.