Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

How to kill the processes accessing Internet in background using terminal commands. Command to stop (disconnect) the processes accessing Internet. Command to kill the process accessing Internet.

share|improve this question
    
kill -9 'name_of_program_using_internet' –  Nicholi Jul 28 '11 at 0:43
    
@Nicholi : But how to find processes accessing internet ? –  JOHN Jul 28 '11 at 0:50
3  
kill -15 is preferable, since programs designed to respond to the 15 argument will clean up before ending. –  myopic.bones Jul 28 '11 at 0:59

1 Answer 1

up vote 4 down vote accepted

To find any processes making/listening for Internet connections run:

lsof -i

Output will be similar to this:

COMMAND     PID   USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
sshd       4236   root    3u  IPv4   13169      0t0  TCP *:ssh (LISTEN)
ntpd       4260    ntp   16u  IPv4   13192      0t0  UDP *:ntp 
ntpd       4260    ntp   17u  IPv4   13196      0t0  UDP localhost:ntp 
ntpd       4260    ntp   18u  IPv4   13197      0t0  UDP 127.0.0.2:ntp 
master     4431   root   12u  IPv4   13397      0t0  TCP localhost:smtp (LISTEN)
httpd2-pr  4493   root    3u  IPv4   13542      0t0  TCP *:http (LISTEN)

Now use kill with the PID of the processes as listed above, for example, to kill ssh above, run:

sudo kill -15 4236

If that doesn't help, run:

sudo kill -9 4236

Option -15 sends a TERM signal, which kindly asks the process to quit. Option -9 sends a KILL signal, which forces the process to immediately quit. Try -15 first, then -9.

share|improve this answer
    
thanks. is working –  JOHN Jul 28 '11 at 3:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.