How do we run *#06# using ADB to get IMEI number?
This doesn't work on all devices/dialers, but it does on mine so it's worth giving it a shot.  From adb shell:

am start -a android.intent.action.DIAL -d "tel:*%2306%23"


See this chat conversation for more discussion and possibilities.



For just getting the number in the shell, you could also try this:

$ getprop | grep -i IMEI
[persist.sys.oppo.device.imei]: [&lt;IMEI here&gt;]


That's a custom property on my particular device, but yours might have something similar.

Another option if you have root (and possibly needing busybox as well):

$ su
# service call iphonesubinfo 1 | awk '{ print $NF }' | sed 's/[^0-9]*//g' | tr -d '[:space:]' | sed 's/$/\n/'
&lt;IMEI here&gt;


One more that is probably device-specific:

$ content query --uri content://settings/system --where "name='bd_setting_i'" | sed 's/[^=0-9]*//g' | sed 's/[0-9]*=//g'
&lt;IMEI here&gt;