-
-
Save rvill/60ce9d7016581b84c343 to your computer and use it in GitHub Desktop.
get iOS device UDID without xcode or itunes, using linux cmd line
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lsusb -v 2> /dev/null | grep -e "Apple Inc" -A 2 |
You can also obtain the UDID in the following way:
- Connect your device to the computer via USB.
- Run the command
idevice_id -l
to obtain the ID of the connected device. - Run the command
ideviceinfo -u [device ID obtained in step 2]
. - Look for the "UniqueDeviceID:" field, where you can find the UDID.
One line command: ideviceinfo -u $(idevice_id -l) | awk '/UniqueDeviceID:/ {print $2}'
This version works:
lsusb -s
lsusb | grep "Apple" | cut -d ' ' -f 2:
lsusb | grep "Apple" | cut -d ' ' -f 4 | sed 's/://'-v | grep iSerial | awk '{print $3}'
however you need to add a hyphen after the 8th character like00001111-01010101010101
The command with fixed formatting:
lsusb -s `lsusb | grep "Apple" | cut -d ' ' -f 2`:`lsusb | grep "Apple" | cut -d ' ' -f 4 | sed 's/://'` -v | grep iSerial | awk '{print $3}'
Instead of backticks, it is possible to use $()
notion, which does not confuse markup that much:
lsusb -s $(lsusb | grep "Apple" | cut -d ' ' -f 2):$(lsusb | grep "Apple" | cut -d ' ' -f 4 | sed 's/://') -v | grep iSerial | awk '{print $3}'
lsusb -d 05ac: -v 2>/dev/null | grep iSerial | awk '{print $NF}'
A variation on @GoodMirek response that adds the hypen for you in the right spot(after the 8th character)
lsusb -s $(lsusb | grep "Apple" | cut -d ' ' -f 2):$(lsusb | grep "Apple" | cut -d ' ' -f 4 | sed 's/://') -v | grep iSerial | awk '{print $3}' | sed 's/^\(........\)/\1-/'
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Maybe there is a command for Android devices to fetch UDID without Android-SDK?