2

I tried T-ui and although it has the lsof command, it cannot do lsof -i for example, so I need to go through every single process in Android. My phone is rooted and I wanna know the PID of the process listening to a specific port. Thanks!

EDIT:
Oh yeah, netstat command also don't allow any option, so if you guys know some terminal with the complete netstat command that would do it.

0

1 Answer 1

2

Standard lsof source code has some differences with Android implementation. Android's own /system/bin/lsof or /vendor/bin/lsof (both provided by toybox) work perfectly, but with somewhat limited options.

However, to view listening ports, you have multiple options:

  • netstat static binary compiled from standard source
  • Netstat Plus app
  • Netstat applet shipped with busybox (app or any standalone busybox) or the one that comes bundled with Android (at least on Android Pie, not sure about older versions); /system/bin/netstat or /vendor/bin/netstat (both provided by toybox) also offer enough options
  • ss command; the Android one (standalone binary shipped at least with Pie) i.e. /system/bin/ss or static binary

To view processes:

  • ps static binary compiled from standard source
  • ps applet that comes bundled with Android; /system/bin/ps or /vendor/bin/ps (both provided by toybox) also offer enough options
  • ps provided by Termux (procps-ng package) is a complete Linux ps

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.