第一种:
查看ssh服务
[root@localhost shell]# netstat -anlp | grep :22
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 2227/sshd
tcp 0 52 192.168.81.193:22 192.168.80.82:50939 ESTABLISHED 22325/sshd: root@pt
tcp6 0 0 :::22 :::* LISTEN 2227/sshd
找到了pid,然后根据pid查找,下图里面exe文件夹,软连接的地址就执行程序的所在地址
[root@localhost shell]# ll /proc/2227/
总用量 0
dr-xr-xr-x. 2 root root 0 11月 18 22:43 attr
-rw-r--r--. 1 root root 0 11月 18 22:43 autogroup
-r--------. 1 root root 0 11月 18 22:43 auxv
-r--r--r--. 1 root root 0 11月 18 22:43 cgroup
--w-------. 1 root root 0 11月 18 22:43 clear_refs
-r--r--r--. 1 root root 0 11月 17 10:34 cmdline
-rw-r--r--. 1 root root 0 11月 18 22:43 comm
-rw-r--r--. 1 root root 0 11月 18 22:43 coredump_filter
-r--r--r--. 1 root root 0 11月 18 22:43 cpuset
lrwxrwxrwx. 1 root root 0 11月 18 22:43 cwd -> /
-r--------. 1 root root 0 11月 18 22:43 environ
lrwxrwxrwx. 1 root root 0 11月 18 22:43 exe -> /usr/sbin/sshd
dr-x------. 2 root root 0 11月 18 22:43 fd
dr-x------. 2 root root 0 11月 16 14:59 fdinfo
-rw-r--r--. 1 root root 0 11月 18 22:43 gid_map
-r--------. 1 root root 0 11月 18 22:43 io
-r--r--r--. 1 root root 0 11月 18 22:43 limits
-rw-r--r--. 1 root root 0 11月 18 22:43 loginuid
dr-x------. 2 root root 0 11月 18 22:43 map_files
-r--r--r--. 1 root root 0 11月 18 22:43 maps
-rw-------. 1 root root 0 11月 18 22:43 mem
-r--r--r--. 1 root root 0 11月 18 22:43 mountinfo
-r--r--r--. 1 root root 0 11月 18 22:43 mounts
-r--------. 1 root root 0 11月 18 22:43 mountstats
dr-xr-xr-x. 5 root root 0 11月 18 22:43 net
dr-x--x--x. 2 root root 0 11月 18 22:43 ns
-r--r--r--. 1 root root 0 11月 18 22:43 numa_maps
-rw-r--r--. 1 root root 0 11月 18 22:43 oom_adj
-r--r--r--. 1 root root 0 11月 18 22:43 oom_score
-rw-r--r--. 1 root root 0 11月 18 22:43 oom_score_adj
-r--r--r--. 1 root root 0 11月 18 22:43 pagemap
-r--r--r--. 1 root root 0 11月 18 22:43 personality
-rw-r--r--. 1 root root 0 11月 18 22:43 projid_map
lrwxrwxrwx. 1 root root 0 11月 18 22:43 root -> /
-rw-r--r--. 1 root root 0 11月 18 22:43 sched
-r--r--r--. 1 root root 0 11月 18 22:43 sessionid
-rw-r--r--. 1 root root 0 11月 18 22:43 setgroups
-r--r--r--. 1 root root 0 11月 18 22:43 smaps
-r--r--r--. 1 root root 0 11月 18 22:43 stack
-r--r--r--. 1 root root 0 11月 17 10:35 stat
-r--r--r--. 1 root root 0 11月 18 22:43 statm
-r--r--r--. 1 root root 0 11月 17 10:34 status
-r--r--r--. 1 root root 0 11月 18 22:43 syscall
dr-xr-xr-x. 3 root root 0 11月 18 22:43 task
-r--r--r--. 1 root root 0 11月 18 22:43 timers
-rw-r--r--. 1 root root 0 11月 18 22:43 uid_map
-r--r--r--. 1 root root 0 11月 18 22:43 wchan
第二种:
ss -nlp | grep 50200
LISTEN 0 100 *:50200 *:* users:(("java",16536,42))
ps -ef | grep 16356
root 8813 8782 0 13:44 pts/2 00:00:00 grep 16536
root 16536 1 0 Oct10 ? 03:49:04 /opt/jdk1.7.0_67/bin/java -Djava.util.logging.config.file=/opt/eai51cs/conf/logging.properties -server -d64 -Xms512M -Xmx1024M -Xss256k -XX:PermSize=64M -XX:MaxPermSize=300M -XX:+AggressiveOpts -XX:+UseParallelGC -XX:+UseBiasedLocking -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Dbuild.compiler.emacs=true -Djava.endorsed.dirs=/opt/eai51cs/endorsed -classpath /opt/eai51cs/bin/bootstrap.jar -Dcatalina.base=/opt/eai51cs -Dcatalina.home=/opt/eai51cs -Djava.io.tmpdir=/opt/eai51cs/temp org.apache.catalina.startup.Bootstrap start
两种查端口然后知道程序所在位置方法,与君共勉。
浙公网安备 33010602011771号