Dialler access codes are disabled on at least some Moto G variants. If it's not disabled it should be *#*#4636#*#*
If it is disabled and you are using a Launcher that supports shortcuts to app activities it's pretty straightforward to create a shortcut to the .TestingSettings activity (which is what the dialler code takes you to).
If not the free app on the Play Store 'Phone Testing' does the same thing.
echo 'AT+EGMR=1,7,"IMEI_1"' > /dev/pttycmd1
echo 'AT+EGMR=1,10,"IMEI_2"' > /dev/pttycmd1