Solved

Command Line Tool to close a connection

Posted on 2004-09-08
6
232 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Zeek0
ID: 12008646
pro
0
 
LVL 14

Accepted Solution

by:
kenfcamp earned 50 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
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…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

685 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