Lsof Port View

Source: Internet
Author: User

1. To view the Port Usage command: lsof-i
[Root@www ~]# Lsof-i

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
Nginx 2333 root 6u IPv4 6242 TCP *:http (LISTEN)
Nginx 2334 www 6u IPv4 6242 TCP *:http (LISTEN)
sshd 2349 root 3u IPv6 6283 TCP *:ndmp (LISTEN)
sshd 2349 Root 4u IPv6 6286 TCP *:ssh (LISTEN)

This returns the current usage of all open ports on Linux.
The first paragraph is the process, and the last column is the protocol to listen on, the IP and port number to listen to, and the state.
If the port number is a known common service (such as 80, 21, and so on), the protocol name is displayed directly, such as HTTP, FTP, SSH, and so on.


2. View the occupancy of a port: Lsof-i: Port number
[Root@www ~]#lsof-i:21

COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
PURE-FTPD 2651 Root 4u IPv4 7047 TCP *:ftp (LISTEN)
PURE-FTPD 2651 root 5u IPv6 7048 TCP *:ftp (LISTEN)

This shows that port 21st is being used by PURE-FTPD and the state is listen.

Lsof Port View

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.