Example uses of the command "ping"

An Introductory Tutorial

ping linux command

The ping command is used to check if there is a network connection to another computer. When a web browser fails to connect to a web site on the Internet or LAN (local area network) the cause is often the web server, which may be down or overloaded, or it may be a network failure that prevents the connection to the other machine. Therefore the first step in diagnosing the problem is to test if the network connection is working.

The ping command does that without requiring a web server. In a shell window you simply type "ping" followed by the URL or IP address of the computer you want to test. Your computer will respond with a summary of the results of each attempt to contact that computer. For example

ping www.google.com

will attempt to elicit a response from the computer with the IP address linked to the URL www.google.com. You can also directly use the IP address of the machine (which you can find out with the ping command). For example


Both commands will periodically send a message to the target machine and wait for a response. If a response is received the command output will specify how long it took. You can terminate the process with Ctrl-c. The command is called ping since it is analogous to the echo location method used by submarines that sends out a pulse sound called ping to create an echo from nearby objects.

More From Us