Sometimes it is necessary to look at a process that takes up that port, but only knows the approximate name of the process, such as which port the Namenode of Hadoop is running on, in order to connect in eclipse. A method is as follows, may compare rubbing, please daniel advice!
First, use the PS command to view the process ID:
[HTML]View Plaincopy
- $ PS-EF | grep Name
The second field in which each row (a long time takes up several rows) is the ID of the process.
Of course, for a process running in a Java virtual machine, such as a Hadoop daemon, you can view it directly with the JSP command:
[HTML]View Plaincopy
- $ JPS | grep Name
Or you already know the exact name of the process, which can be viewed with pidof:
[HTML]View Plaincopy
- $ pidof Name
After viewing the process ID, use the netstat command to view the ports it occupies:
[HTML]View Plaincopy
- $ NETSTAT-NAP | grep pid
Linux views its occupied ports based on the process name