1819866 Members
2757 Online
109607 Solutions
New Discussion юеВ

ping hostname

 
subhashni
Regular Advisor

ping hostname

Hi
I'm not able to terminate the message in the terminal(64 bytes from ip icmp_seq172 time=.0 ms)after running the comman "ping hostname".
Normally the ping command will end up with round trip message(if we terminate-right?).Please suggest me what is wrong in it.
Thanks
unix4me
9 REPLIES 9
Rodney Hills
Honored Contributor

Re: ping hostname

ping will continue until aborted. Sometimes a terminals interupt key gets changed from its usual ^C. Try control-\.

If that fails, log onto another session and use "kill" to terminate the ping.

-- Rod Hills
There be dragons...
James R. Ferguson
Acclaimed Contributor

Re: ping hostname

Hi:

Try :

# ping -o hostname

Regards!

...JRF...
Sajid_1
Honored Contributor

Re: ping hostname

hello,

You can stop it with a 'Ctrl+C'

HTH
learn unix ..
Hai Nguyen_1
Honored Contributor

Re: ping hostname

Subhashni,

By default, the ping command will not terminate itself until you hit Control+C. To have it terminate itself, you need to use option -n . For example:

# ping host_name -n 1

will ping the host only once and terminate.

Hai
subhashni
Regular Advisor

Re: ping hostname

Thank you all for the replies,my question is
in some hosts i can terminate the messages of course by using ctrl c,in some i do not.Just i want to know the cause for this.Thanks again thanks for your responses.
Thanks
unix4me
MANOJ SRIVASTAVA
Honored Contributor

Re: ping hostname

it depends on the shell envvariables in which you are working , if you are able to do a cntrl c and get teh prompt back then there shoudl be no problem to terminate ping too , the better way amy be to change to a new shell and try it.


Manoj Srivastava
Hai Nguyen_1
Honored Contributor

Re: ping hostname

Subhashni,

It depends on your stty settings. On hosts where you're able to use CTRL+C to terminate ping, your stty intr is set to ^C. You can run this command to verify:

# stty -a | grep intr

To set intr to ^C, do this:

# stty intr ^C

You may want to set it in system profiles .login, .profile.

Hai
James R. Ferguson
Acclaimed Contributor

Re: ping hostname

Hi (again):

You can specify the number of pings. Thus to execute 3-pings and terminate with the routes taken, do:

# ping -o hostname -n 3

Regards!

...JRF...
subhashni
Regular Advisor

Re: ping hostname

Oh, i forgot to check the intr.Thank you guys.
unix4me