Linux view ports and processes

Source: Internet
Author: User

View process

Ps-aux | grep AppName

Kill process

Kill PID

To view ports:

Netstat-ap | grep Port number

Netstat-ap | grep process Name

lsof-i: Port number

Example: Server This program will open 8888 this port.

[Email protected]:/mnt/hgfs/code/svn/net_code/dd#./server &
[1] 3779
[Email protected]:/mnt/hgfs/code/svn/net_code/dd# netstat-ap | grep 8888
TCP 0 0 localhost:8888 *:* LISTEN 3779/server
[Email protected]:/mnt/hgfs/code/svn/net_code/dd# netstat-ap | grep server
TCP 0 0 localhost:8888 *:* LISTEN 3779/server
UNIX 3 [] stream connected 23278 3779/server
UNIX 3 [] stream connected 23277 3779/server

[Email protected]:/mnt/hgfs/code/svn/net_code/dd# lsof-i:8888
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
Server 3779 root 3u IPv4 23688 0t0 TCP localhost:8888 (LISTEN)


[Email protected]:/mnt/hgfs/code/svn/net_code/dd# kill 3779
[1]+ has been terminated./server
[Email protected]:/mnt/hgfs/code/svn/net_code/dd# netstat-ap | grep server

Linux view ports and processes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.