How to check the process number occupied by the port and program name in Linux

Source: Internet
Author: User

Check port usage in linux:
1.
Check which process occupies port 819:

Case9-sghfofo:/usr/local/cnbj/tomcat-bj/bin # lsof-I: 859
Result After running:
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
Java 24907 root 31u IPv4 248905027 TCP *: 859 (LISTEN)

From the above we know that port 859 is occupied by the process with process number 24907, and it is a java Process.

2.
Check where the process with process number 24907 is located:

Case9-sghfofo:/usr/local/cnbj/tomcat-bj/bin # ps-ef | grep 24907
Root 13421 29276 0 00:00:00 pts/2 grep 24907
Root 24907 1 0 00:03:53 pts/4/usr/java/jdk1.6.0 _ 13/bin/java-server-XX: PermSize = 256 M-XX: maxPermSize = 512 m-Xbootclasspath/p: java-net-Socket.jar-Djava. util. logging. manager = org. apache. juli. classLoaderLogManager-Djava. util. logging. config. file =/usr/local/cnsh/tomcat-sh/conf/logging. properties-Djava. endorsed. dirs =/usr/local/cnsh/tomcat-sh/bin/endorsed-classpath:/usr/local/cnsh/tomcat-sh/bin/bootstrap. jar-Dcatalina. base =/usr/local/cnsh/tomcat-sh/bin-Dcatalina. home =/usr/local/cnsh/tomcat-sh/bin-Djava. io. tmpdir =/usr/local/cnsh/tomcat-sh/bin/temp-Xmx512m-Xms256m org. apache. catalina. startup. bootstrap start

From the above we know That tomcat in the/usr/local/cnsh/tomcat-sh/bin/directory is occupied.

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.