I have connected to a machine running Linux via SSH and would like to know; is there any command to ping a computer, or translate domain name to ip address in Linux?

  • To literally answer their question: No their isn't. SSH is just another application/protocol. It is like you are asking whether your email application can open MS Word documents... Maybe you have to learn first what SSH is: en.wikipedia.org/wiki/Secure_Shell – Felix Oct 18 '10 at 20:13

"ping" and "nslookup" assuming the machine you've SSH'd to has them installed:

you@yourhost:~$ ping www.google.com
PING www.l.google.com ( 56(84) bytes of data.
64 bytes from lhr14s02-in-f104.1e100.net ( icmp_seq=1 ttl=57 time=27.8 ms
64 bytes from lhr14s02-in-f104.1e100.net ( icmp_seq=2 ttl=57 time=27.1 ms

you@yourhost:~$ nslookup www.google.com

Non-authoritative answer:
www.google.com  canonical name = www.l.google.com.
Name:   www.l.google.com
| improve this answer | |

Pay attention, people with years of experience overlook this. I apologise to Windows users presumably using PuTTY.

On Linux systems (clients), SSH resolves the host "name" in this order...

(Ubuntu naming shown as an example)

  1. Entries in ~/.ssh/config
  2. Entries in /etc/ssh/ssh_config
  3. Entries in /etc/hosts ...etc.

This resolution is local and "nslookup" does not see these. You need to look yourself if strange results are occurring. Your router may cache DNS lookups as well. This will be an issue if your host is a laptop and frequently changes IP addresses.

| improve this answer | |

Did you mean you are logged in and you want to ping a server?

You can find the ping binary in :

/bin/ping google.fr
| improve this answer | |
  • ...or traceroute, dig, nslookup. Possibly even curl or wget. – mckenzm Apr 5 '18 at 7:16

You can use which to see where the programs are that you want to use.

$ which ping

$ /sbin/ping google.com
| improve this answer | |

For translate domain name to IP address in Linux, you can do that:

host domain.com
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy