Get application version name using adb

Is there an easy way to get the version name of an application on an Android device using adb shell?

I found the application version number (not the version name) in /data/system/packages.xml.

It would be nice if there was a file that contained the Application Info.


adb shell dumpsys package my.package | grep versionName

as mentioned by @david and @Jeremy Fishman. This will be much quicker than:

adb shell dumpsys | grep -A18 "Package \[my.package\]"

Dumpsys package is your friend

~/# adb shell
shell@mo:/ dumpsys package tld.comp.app_name | grep version


Will return

versionCode=X targetSdk=YY
versionName=Z.Z