InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Android development tutorials

  • Android - Show top processes using adb
  • Android studio keyboard shortcuts
  • Disable sleep during android usb debugging
  • Download apk using AirDroid
  • Enable usb debugging
  • Exerciser monkey tutorial
  • Find top processes by memory/cpu on Android using Adb
  • Find used ports by an app on Android using Adb
  • Install Android 8 on Pixel 2
  • Root Android pixel 2 using Magisk and boot image patching
  • Transfer android apk using adb
  • Using Google analytics SDK v2 for android app real time tracking
  • View Desktop Site
  • adb tutorial
 
  • Home
  • > Tutorials
  • > Android Development

Find used ports by an app on Android using Adb

on Sep 4, 2022

This article will cover steps to find used ports (on destination side) by an app on Android using adb command. We will use pixel-2 for this article. But any other android phone can also be used. These steps require Android phone to be rooted.

  1. Install adb tools on your PC (Mac) and enable developer mode on android phone.
  2. Root the Android phone. Here are the root steps for pixel-2.
  3. Connect android phone with Laptop using USP port
  4. Find the process id (PID) of the app using adb and top.
  5. Run the following command to see ports opened using adb and lsof (after replacing the 5882 with correct PID for you). This command will ignore the ports in CLOSE_WAIT state.
    adb shell "su -c lsof | grep 5882 | egrep 'TCP|UDP' | grep -v CLOSE_WAIT"
  6. Here is how the outcome looks like for Youtube
  7. Here we can see that Youtube app has connected to ports 443, 8008, 80 to various servers.

The above steps can be used to debug an app.

Suggested posts:

  1. Root Android pixel 2 using Magisk and boot image patching
  2. Find top processes by memory/cpu on Android using Adb
  3. Linux – number of cpus (lscpu)
  4. curl – some handy commands
  5. How to download apk from mobile using AirDroid
  6. Use x2go to access remote Ubuntu Linux
  7. How to take screenshot on android phone
  8. How to extract number from a string – google sheets
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged ADB, Android Development, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress