Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Command Line Tool to close a connection

Posted on 2004-09-08
6
Medium Priority
?
253 Views
Last Modified: 2010-04-11
I have what I hope is a simple question:

How can I close an unwanted tco/ip session from the command line?

I've been running the netstat tool to keep an eye on things, and occasionally I'll have a connection that I don't want but can't terminate.  Since it's not a file share, I don't know of any way to target the connection and cut it off.  Any ideas?
0
Comment
Question by:Zeek0
  • 4
  • 2
6 Comments
 
LVL 14

Expert Comment

by:kenfcamp
ID: 12007784
What OS are you using?

Under linux:

type who to get the TTY the offending connection is using
<user>       pts/0    Sep  8 11:52
<user>       pts/1    Sep  8 11:52

type ps -ax to get running processes

PID TTY      STAT   TIME COMMAND
31513 pts/1    S      0:00 -bash
31586 pts/0    S      0:00 -bash

as root type kill -9 <PID>

If pts/0 was the offending connection (using the above example) you'd type

kill -9 31586 (as root)

Hope this helps

KC

0
 

Author Comment

by:Zeek0
ID: 12008195
Unfortunately, I'm asking about how to do it in XP.  It seems like an obvious task, but I haven't ever seen a way to do it - I'd prefer to use the command line, but any other strategies would be fine.
0
 
LVL 14

Expert Comment

by:kenfcamp
ID: 12008352
Home or pro?
0
 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

 

Author Comment

by:Zeek0
ID: 12008646
pro
0
 
LVL 14

Accepted Solution

by:
kenfcamp earned 200 total points
ID: 12008972
Do you generaly know the PID of the offending connection/service ?

If so try taskkill /PID <pid number>

ELSE

Type tasklist to obtain a list of running processes
Locate the PID you're looking to kill
type taskkill /pid <pid number>

KC
0
 
LVL 14

Expert Comment

by:kenfcamp
ID: 12008996
PS

To test this (play with it)

open 1 or 2 cmd consoles

as admin open a console and go to it..

NOTE: You will not be able to close down the cmd PID you're running the commands on

KC
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

WARNING:   If you follow the instructions here, you will wipe out your VTP and VLAN configurations.  Make sure you have backed up your switch!!! I recently had some issues with a few low-end Cisco routers (RV325) and I opened a case with Cisco TA…
Make the most of your online learning experience.
After creating this article (http://www.experts-exchange.com/articles/23699/Setup-Mikrotik-routers-with-OSPF.html), I decided to make a video (no audio) to show you how to configure the routers and run some trace routes and pings between the 7 sites…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question