Ubuntu terminal command -- view port usage and disable

Source: Internet
Author: User
Run the netstat command to view port usage in Ubuntu: view the connected service port (ESTABLISHED) netstat-a to view all service ports (LISTEN, ESTABLISHED) netstat-ap to view the specified port, you can use the grep command: netstat-ap | grep8080 or lsof command: lsof-I: 8888.

Run the netstat command to view port usage in Ubuntu:

View the connected service port (ESTABLISHED)

Netstat-

View All service ports (LISTEN, ESTABLISHED)

Netstat-ap

To view the specified port, run the grep command:

Netstat-ap | grep 8080

You can also use the lsof command:

Lsof-I: 8888

To disable the program that uses this port, use kill + corresponding pid.

Kill-9 PID no.

Ps: kill sends a signal to a process id. The signal sent by default is SIGTERM, while the signal sent by kill-9 is SIGKILL, that is, exit. The exit signal is not blocked by the system, so kill-9 can successfully kill the process.

For more information about Ubuntu, see Ubuntu special page http://www.linuxidc.com/topicnews.aspx? Tid = 2

This article permanently updates the link address: Http://www.linuxidc.com/Linux/2016-01/127345.htm

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.