1. Enable Developer Mode and USB Debugging[LIST=1]
- Go to settings on your phone
- Go to "About Phone"
- Tap "Built Number" a bunch of times
- Go back
- Go to "Developer Options"
- Check "USB Debugging"
- Click "OK"
2. Install ADB and Fastboot toolsThis is how you install ADB and Fastboot in Ubuntu Linux. I'll let you figure it out for other Linux operating system.
sudo apt-get install android-tools*
After installing, you should be able to run both adb and fastboot.
3. Unlock BootloaderFirst, make sure adb can see your device:
adb devices
Reboot to bootloader:
adb reboot bootloader
Then, unlock the bootloader (this may need "sudo"):
fastboot oem unlock
4. Flash RootFirst, download
CF-Auto_rootFor N5 Download
CF-Auto-Root-hammerhead-hammerhead-nexus5.zipThen, run:
unzip CF-Auto-Root-hammerhead-hammerhead-nexus5.zip
cd image/
sudo fastboot boot CF-Auto-Root-hammerhead-hammerhead-nexus5.img
This takes about a minute or two. It will reboot on its own...
5. Done!And that's it! When your phone reboots, it should walk you through the setup process again. To make sure if this worked, make sure the SuperSU app is intalled.
--
Ref: schier.co/blog/2013/11/09/how-to-root-nexus-5-in-linux.html