Some of the apparatus utilized in neighborhood control and computer diagnostics, the ping
command sticks out as one of the most elementary and widely-used. A command-line tool available in just about every working device, ping
serves as the most important diagnostic device for neighborhood engineers, device administrators, and even curious tech enthusiasts.
The ping
command sends small packets of data to a specified IP handle or host, and in return, it expects to acquire a resolution. Thru doing so, it’s serving to consumers make a decision if a neighborhood instrument is reachable and gives treasured information about the neighborhood’s response time and reliability. Whether or not or no longer you’re troubleshooting connectivity issues, monitoring neighborhood potency, or just starting your journey into neighborhood keep watch over, the ping
command is a must-know.
Not unusual syntax for ping
command:
ping [IP-ADDRESS]
1. Specify the selection of packets
ping -c [number] [IP-Address]
Use the -c
solution to have the ping command mechanically stop after a certain selection of packets were sent.
Example:
While you run the ping
command with the -c 5
solution to send 5 packets to the IP handle 127.0.0.1,
you’ll expect to seem an output similar to the following:
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.045 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.058 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.056 ms 64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.059 ms 64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.057 ms --- 127.0.0.1 ping statistics --- 5 packets transmitted, 5 received, 0% packet loss, time 3999ms rtt min/avg/max/mdev = 0.045/0.055/0.059/0.006 ms
2. Check out Localhost neighborhood
ping localhost
Should you occur to’re having trouble connecting to a some distance flung computer or website, ping the localhost to remember to’re hooked up.
Example:
While you execute the ping
command with localhost
, you’re essentially pinging your own device. Proper right here’s a development output it’s essential see:
PING localhost (127.0.0.1) 56(84) bytes of data. 64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.033 ms 64 bytes from localhost (127.0.0.1): icmp_seq=2 ttl=64 time=0.031 ms 64 bytes from localhost (127.0.0.1): icmp_seq=3 ttl=64 time=0.031 ms 64 bytes from localhost (127.0.0.1): icmp_seq=4 ttl=64 time=0.030 ms --- localhost ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 2998ms rtt min/avg/max/mdev = 0.030/0.031/0.033/0.001 ms
3. Send pings only for a limited period of time
ping -i [number] [IP-Address]
The -i
selection gadgets the timeout length in seconds previous to each and every packet is shipped.
Example:
The command ping -i 5 127.0.0.1
will send ICMP Echo Request packets to the loopback handle 127.0.0.1
every 5 seconds. Proper right here’s a development output:
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.035 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.040 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.038 ms 64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.039 ms --- 127.0.0.1 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 15005ms rtt min/avg/max/mdev = 0.035/0.038/0.040/0.007 ms
In this example, each and every request has been spoke again to in less than a millisecond, and no packets were out of place. The output would in all probability vary depending to your device configuration and the existing device load.
4. Flood ping to concentrate on host
ping -f [IP-address]
The -f
selection will send the packets as speedy as conceivable. It is going to flood the neighborhood, so it’s incessantly referred to as “flood ping.” It’s mainly used for drive testing and should be used with caution.
Given that packets are sent as speedy as conceivable, there will not be detailed output like the usual ping. Instead, you’ll merely see a series of dots, and backspaces may well be published as packets are sent and received.
Example:
An unusual output might look something like this:
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. ..........................................................^C --- 127.0.0.1 ping statistics --- 468751 packets transmitted, 468750 received, 0% packet loss, time 330ms rtt min/avg/max/mdev = 0.025/0.035/0.139/0.002 ms, pipe 2, ipg/ewma 0.182/0.037 ms
Realize that the ^C
above represents pressing Ctrl + C to prevent the command. It’s very important to grab that the flood selection does require root privileges, so it’s essential need to run this command with sudo
if you’re now not the root particular person.
5. Industry ping packet size
ping -s [number] [IP-Address]
Use the -s
solution to building up the default packet size, you’ll send gentle and heavy packets.
Example:
The command ping -s 1000 127.0.0.1
sends ICMP echo requests to the loopback handle 127.0.0.1
with a packet size of 1000 bytes. Proper right here’s an example of what the output might look like:
PING 127.0.0.1 (127.0.0.1) 1000(1028) bytes of data. 1008 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.050 ms 1008 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.054 ms 1008 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.050 ms 1008 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.054 ms --- 127.0.0.1 ping statistics --- 4 packets transmitted, 4 received, 0% packet loss, time 3071ms rtt min/avg/max/mdev = 0.050/0.052/0.054/0.002 ms
6. Display absolute best the summary strains
ping -q [IP-Address]
The -q
selection outputs a single line with the typical ping knowledge, followed by the use of the statistics.
Example:
While you run the ping
command with the -q
flag on the loopback handle 127.0.0.1
, it sends ICMP ECHO_REQUEST packets to neighborhood hosts. The -q
flag makes the command run in “quiet” mode, where it absolute best displays the summary statistics when finished. The output might look something like this:
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. --- 127.0.0.1 ping statistics --- 10 packets transmitted, 10 received, 0% packet loss, time 8999ms rtt min/avg/max/mdev = 0.045/0.057/0.082/0.012 ms
7. Set Time Prohibit for receiving methods
ping -w [seconds] [IP-Address]
This option stops receiving ping
output after a certain time frame.
Example:
While you run the ping
command with the -w 10
solution to the loopback handle 127.0.0.1
, it sends ICMP echo request packets to the handle and waits up to 10 seconds for the replies. Proper right here’s an example output it’s essential see:
PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data. 64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.041 ms 64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.040 ms 64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.041 ms 64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.038 ms ... --- 127.0.0.1 ping statistics --- 10 packets transmitted, 10 received, 0% packet loss, time 8999ms rtt min/avg/max/mdev = 0.038/0.041/0.045/0.002 ms
Additional Linux directions:
Record Operations | rmdir · cd · pwd · exa · ls |
Report Operations | cat · cp · dd · much less · contact · ln · rename · extra · head |
Report Device Operations | chown · mkfs · find |
Networking | ping · curl · wget · iptables · mtr |
Search and Text Processing | in finding · grep · sed · whatis · ripgrep · fd · tldr |
Device Wisdom and Keep an eye on | env · historical past · most sensible · who · htop · glances · lsof |
Individual and Session Keep an eye on | display · su · sudo · open |
The submit Learn how to Use the Ping Command in Linux seemed first on Hongkiat.
Supply: https://www.hongkiat.com/blog/linux-command-ping/
Contents
- 0.0.0.1 1. Specify the selection of packets
- 0.0.0.2 2. Check out Localhost neighborhood
- 0.0.0.3 3. Send pings only for a limited period of time
- 0.0.0.4 4. Flood ping to concentrate on host
- 0.0.0.5 5. Industry ping packet size
- 0.0.0.6 6. Display absolute best the summary strains
- 0.0.0.7 7. Set Time Prohibit for receiving methods
- 0.0.0.8 Additional Linux directions:
- 0.1 Related posts:
- 1 Get a FREE Essential Oils Layout Pack for Divi
- 2 10 Possible choices to Google Analytics to Believe
- 3 Find out how to construct WordPress internet apps the use of a microservices structure
0 Comments