Details about port usage in linux, and details about linux

Source: Internet
Author: User

Details about port usage in linux, and details about linux

The port is often occupied when a program is started. Here we will explain how to check whether the port is occupied, and which program is occupied, and how to Kill the program with the occupied port.

 

1. lsof-I: port

Port is the port number.

 

[Root @ slave/data/spark-1.4.0-bin-cdh4] # lsof-I: 8080

Command pid user fd type device size/OFF NODE NAME

Impalad 11978 mqq 150u IPv4 549847837 0t0 TCP *: webcache (LISTEN)

 

The above command shows that port 8080 is occupied by impalad, and the process ID is 11978.

To kill the process, run the following command:

Kill-9 11978 kill the program

 

2. Run the netstat and ps commands to check the port-consuming program and process ID.

[Root @ slave/data/spark-1.4.0-bin-cdh4] # netstat-apn | grep 8080

Tcp 0 0 0.0.0.0: 8080 0.0.0.0: * LISTEN 11978/impalad

Tcp 0 0 192.168.209.16: 53501 192.168.209.19: 8080 TIME_WAIT-

 

We can see that 8080 is occupied by impalad and the process ID is 11978. Then we can see the path of the program through the following command.

 

[Root @ slave/data/spark-1.4.0-bin-cdh4] # ps-elf | grep impalad

0 S of mqq 11978 1 9 80 0-15906542 futex _ Jun25? 2-01:23:55/usr/lib/impala/sbin/impalad-log_dir =/data/log/impala-catalog_service_host = host. impala-state_store_port = 24000-use_statestore-webserver_port = 8080-state_store_host = host. impala-be_port = 22000-default_query_options = DEFAULT_ORDER_BY_LIMIT = 1000000

 

0 S root 27963 24729 0 80 0-25810 pipe_w 00:00:00 pts/5 grep impalad

Java enterprise-level general permission security framework source code SpringMVC mybatis or hibernate + ehcache shiro druid bootstrap HTML5

 

[Download java framework source code]

 

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.