How to use ADB shell to find the ports which a process is using?

23,613

You can either use busybox netstat -pt or cat /proc/1234/net/tcp

Share:
23,613
Admin
Author by

Admin

Updated on July 19, 2022

Comments

  • Admin
    Admin almost 2 years

    For example, in Android, the PID of a process 1234 is using ports 2222,2223,2224. Now I have a PID 1234. I was wondering how to find out port numbers 2222, 2223, 2224 which the process is using?

    I have tried using netstat -anp just as the way in Linux, but that didn't work. netstat -anp in ADB shell has the same effect as just netstat, which is without any command arguments.

  • Ken Sharp
    Ken Sharp over 8 years
    This assumes that busybox is installed.
  • Arpit Aggarwal
    Arpit Aggarwal over 7 years
    @Alex cat /proc/1234/net/tcp lists all the tcp sockets on the system, not just the sockets opened by process 1234.