Posts Tagged ‘CLI’

Windows Command line – CMD – fu : Notes

February 15, 2017 Leave a comment

So i haven’t used the Windows Command (DOS) Prompt for many things until I realized that Android / Android Studio / Android SDK and the emulator (with the HAXM driver) work pretty well on Windows.

Long story short, there seems to be a lot of powerful things in this “predecessor” to Powershell.

Viewing and Saving Command History:

One of the things i wanted to do was to view my command line history. This can be easily done by pressing F7 and lo and behold a smaller dialog within the cmd window will appear with the command history.

Now, the F7 trick doesn’t really allow you to save the history, nor to copy-paste it, so i needed another solution. The command below provides this solution.

doskey /history > history.txt 

Essentially, this copies (redirects) the cmd history of only the current session into a text file named history.txt or whatever you’d like to name your text file .






Android Debug Bridge (adb): Useful commands – Notes

January 16, 2017 Leave a comment
  • Accessing an Android Device or Emulator […and getting Shell access]
 adb devices -l 
 adb -e 
 adb -e shell 

TThe -e directive initiates a connection to the Emulator, if there is only one emulator instance, otherwise it will throw an error

 adb -d 
 adb -d shell 

The -d directive initiates a connection to a Physical Android Device connected, if there is only one device connected, otherwise it will throw an error.

 adb -s <device_serial_identifier> 
 adb -s <device_serial_identifier> shell 

If there are multiple emulators, or multiple devices, or multiple of both connected, then the -s directive needs to be used to specify the specific “device/emulator” to connect to.

  • Installing and Uninstalling APKs
 adb -e install <APK_file_path> 
 adb -e uninstall <package_name> 
  • Errors when installing APKs:
      • When the APK has native librariues that were built for a different architecture than what you are trying to run it on e.g. x86 and trying to run it on an ARM device, or built for ARM64 and trying to run it on ARM or x64; or ARM and trying to run it on x86 [1]
  • Getting ADB Root Permissions i.e. Root on the device
 adb root 
  • Listing packages (and file install locations)
 adb -e shell pm list packages -f 
 adb -d shell pm list packages -f 
  • Getting 3rd party packages only:
 adb shell pm list packages -f -3 



Categories: Android Tags: , , ,