Linux displays the port occupied by the process name

Source: Internet
Author: User

Sometimes you need to check the port occupied by a process in Linux, but you only need to know the approximate name of the process. For example, you need to check the port on which the hadoop namenode runs to facilitate connection in eclipse. One method is as follows. It may be awkward. Please advise me! First, run the ps command to view the process id: $ ps-ef | grep Name. The second field of each line (several lines will be occupied for a long time) is the process id. Of course, for processes running in the Java Virtual Machine, such as the hadoop daemon process, you can directly use the jsp command to view: $ jps | grep Name or you already know the exact Name of the process, you can view the process id with pidof: $ pidof Name, and then run the netstat command to view the port occupied by it: $ netstat-nap | grep pid author bhq2010

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.