How to terminate ping <dest> &

Tags:

Answer: 1

27 hours ago

The command

ping <dest> &

causes ping to go to the background. It still prints output to the terminal, however. Ctrl-C does not stop it, only introduces a new prompt. How to stop it from the terminal?

Added by: Travon Cartwright

Answer: 2

1 hours ago

First enter fg into same terminal that your ping command is running (it brings the process into the foreground), then press Ctrl+c to stop the process.

enter image description here

Answer: 3

31 hours ago

If it is your one and only background job you can kill it with kill %1. If not sure you can list all your background jobs with jobs and use kill %<n> where you replace n by the number of your ping job.

Added by: Burnice Hayes

Answer: 4

13 hours ago

When you send a process to the background, whether by using ctrl-z or by & at the end of the command, you get an output in the following format: [index] process-id. If you send multiple processes to the background, the index will keep incrementing every time.

For example:

$ sleep 100 &
[1] 41608
$ sleep 101 &
[2] 41609
$ sleep 102 &
[3] 41610
$ sleep 103 &
[4] 41611
$ sleep 104 &
[5] 41612
$ sleep 105 &
[6] 41613
$ sleep 106 &
[7] 41614

In order to stop a specific one, you can either use kill <process-id> or use fg <index> followed by ctrl-c

Example using the previous output:

$ kill 41614

or

$ fg 7
sleep 106
^C

Answer: 5

4 hours ago

Launch a new tab of terminal, run:

$ pgrep ping
  2564

Then kill the pid using kill command:

$ kill 2564
Added by: Lorenza Mitchell

Answer: 6

17 hours ago

Slightly different approach towards a continuous ping is to use -c option and enter the number of time you want it to run, that way it will stop itself after the desired count i.e. below ping will stop after 100 pings

ping -c 100 192.168.1.1 &

Added by: Lurline Waelchi V

Answer: 7

28 hours ago

When you are root, it's simply killall ping.

Answer: 8

12 hours ago

Just use:

kill -9 %%

and it will kill the current background process you're running.

Answer: 9

11 hours ago

You can see all the process that you put in background (for current session ) with jobs command After you run this command you will see all the process which are running on the current bash and on the left side of each process you can see some numbers :

[1]-  Running                 sleep 200000 &
[2]+  Running                 sleep 300000 &

You can simply terminate jobs (processes) by using kill -15 n% (n is a number that is in [[] sign )

-15 is for terminating process nicely , if you want to force close the process, just use -9 instead of -15 PS : It is obvious if you run a command with root privilege , you have to run kill -15 n% with sudo

2) You can see all of the process that are running on the system with ps -aux and for seeing ping :

ps -aux | grep ping 

The output is like :

root     2615  0.0  0.0  25828  1052 pts/0    S    02:12   0:00 ping 8.8.8.8

The second number (2615) is PID or process ID and you can terminate the process with

sudo kill -15 2615
Added by: Tevin Kassulke Sr.

Popular Search

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9