Process corresponding to linux kill port

 Query port 8101

netstat  -anp  |grep 8101

The result 13701 is the pid

tcp6       0      0 :::8101        :::*         LISTEN     13701/./yuyin-robot 

Then kill 

kill 13701

Get which file is running according to the process id

View process

ps aux

Open the 13701 process directory to get running information

cd /proc/13701

The result information is as follows

101716 -r--r--r--   1 takujo takujo 0 8月   6 13:58 arch_status
101696 dr-xr-xr-x   2 takujo takujo 0 8月   6 13:58 attr
101677 -rw-r--r--   1 takujo takujo 0 8月   6 13:58 autogroup
101672 -r--------   1 takujo takujo 0 8月   6 13:58 auxv
101701 -r--r--r--   1 takujo takujo 0 8月   6 13:58 cgroup
101692 --w-------   1 takujo takujo 0 8月   6 13:58 clear_refs
101680 -r--r--r--   1 takujo takujo 0 8月   6 13:58 cmdline
101678 -rw-r--r--   1 takujo takujo 0 8月   6 13:58 comm
101707 -rw-r--r--   1 takujo takujo 0 8月   6 13:58 coredump_filter
101700 -r--r--r--   1 takujo takujo 0 8月   6 13:58 cpuset
101686 lrwxrwxrwx   1 takujo takujo 0 8月   6 13:58 cwd -> /home/takujo/桌面/dev/goproject/yuyin-robot
101671 -r--------   1 takujo takujo 0 8月   6 13:58 environ
101688 lrwxrwxrwx   1 takujo takujo 0 8月   6 13:58 exe -> /home/takujo/桌面/dev/goproject/yuyin-robot/yuyin-robot

It can be seen that the exe is stored in the directory /home/takujo/desktop/dev/goproject/yuyin-robot/yuyin-robot

Guess you like

Origin blog.csdn.net/takujo/article/details/107838008