Solved

Command Line Tool to close a connection

Posted on 2004-09-08
6
215 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 13

Expert Comment

by:kenfcamp
Comment Utility
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
Comment Utility
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 13

Expert Comment

by:kenfcamp
Comment Utility
Home or pro?
0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

Author Comment

by:Zeek0
Comment Utility
pro
0
 
LVL 13

Accepted Solution

by:
kenfcamp earned 50 total points
Comment Utility
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 13

Expert Comment

by:kenfcamp
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I was recently sitting at a desk at work with one of my colleagues and needed some information on my home computer. He watched as I turned on my home computer, established a remote session into it, got the information I needed and then shut it down …
Article by: IanTh
Hi Guys After a whole weekend getting wake on lan over the internet working, I thought I would share the experience. Your firewall has to have a port forward for port 9 udp to your local broadcast x.x.x.255 but if that doesnt work, do it to a …
Viewers will learn how to connect to a wireless network using the network security key. They will also learn how to access the IP address and DNS server for connections that must be done manually. After setting up a router, find the network security…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now