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