Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
08-14-2003, 04:00 AM
|
#1
|
Member
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380
Rep:
|
How to find the pid to stop a process....
Hello All,
I would like to know how can I find out which process (pid) is running on a certain port so I can stop it?
I can imagine it is somewhere around the netstat -a command... I know the process is running on 8080....
Any thoughts...????
|
|
|
08-14-2003, 04:13 AM
|
#2
|
Senior Member
Registered: Nov 2002
Location: pikes peak
Distribution: Slackware, LFS
Posts: 2,577
Rep:
|
ps aux
|
|
|
08-14-2003, 04:20 AM
|
#3
|
Member
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380
Original Poster
Rep:
|
OK, but where in the output do I relate the port and the PID?
$ ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.0 1336 440 ? S Apr03 2:07 init
root 2 0.0 0.0 0 0 ? SW Apr03 0:00 [migration_CPU0]
root 3 0.0 0.0 0 0 ? SW Apr03 0:00 [migration_CPU1]
root 4 0.0 0.0 0 0 ? SW Apr03 0:01 [keventd]
....
Last edited by vous; 08-14-2003 at 04:26 AM.
|
|
|
08-14-2003, 04:46 AM
|
#4
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
Do you know the name of the process? If you do, the second entry in ps above ( root 2 0.0... ) is the PID.
To kill it:
kill -15 2
Where 2 is the pid of the process (assuming the process you wanna kill is migration_CPU1 ).
So further down your ps string, find the name of the process and kill it similarly. If 15 doesn't kill it, send:
kill -9 pid
instead. A 9 signal is not as clean as a 15, but sometimes is necessary.
For stopping an httpd server though (assuming apache):
apachectl stop
Should suffice...
Cool
|
|
|
08-14-2003, 04:57 AM
|
#5
|
Member
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380
Original Poster
Rep:
|
OK, but my question was how do you know ON WHICH PORT that pid is running?
Any other thoughts...??
|
|
|
08-14-2003, 05:12 AM
|
#6
|
Member
Registered: Mar 2003
Location: Macondo
Distribution: Mandrake 9.1, 10.1, SuSE 8.1 pro, 10.1, Red Hat 8.0/9.0
Posts: 380
Original Poster
Rep:
|
I figured it out...it is:
$ netstat -nap | grep 8080
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 2352/tnslsnr
|
|
|
08-14-2003, 05:18 AM
|
#7
|
LQ Guru
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613
Rep:
|
Re: How to find the pid to stop a process....
Quote:
Originally posted by vous
Hello All,
I would like to know how can I find out which process (pid) is running on a certain port so I can stop it?
|
Your question was kind of vague, but even so, it wasn't exactly what you decided... You found which port, but then you've also now found out how to stop it
Cool
|
|
|
All times are GMT -5. The time now is 04:31 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|