Assuming you have drivers for your phone installed. Download fastboot, adb from google as SDK or individual files only.
-ALWAYS BACKUP YOUR DATA-
-Get your proper factory image from here: Nexus Factory Images
a) Install 7-zip or Winrar, extract the archive.
b) Move fastboot/adb inside the extracted folder.
While in Terminal or Command Prompt:
Running fastboot/adb in linux might involve a few extra steps.
You may need to ‘
sudo chmod +x fastboot‘ or ‘
sudo chmod +x adb‘ to make the files executable.
To get to bootloader from a powered off nexus device hold:
volume up and volume down then push hold power button until you see the android logo.
As of this writing, 4.2.2 is out. You may unlock your nexus by using this command:
fastboot oem unlock
fastboot in linux is:
fastboot flash bootloader bootloader-nameType-versionType.img
fastboot flash radio radio-nameType-versionType.img
fastboot -w update image-nameType-versionType.zip
The .zip file above ^^^ is the payload, exercise patience while it completes.
At this point ^ you may push a recovery of choice:
fastboot flash recovery recoveryImage.img
Proceed to flash whatever rom you wish via recovery.
Some fastboot and adb commands found here are universal to android devices.