Rooting and Updating Android on a Google Nexus

Install tools - Ubuntu 14.04

sudo apt-get install android-tools-adb android-tools-fastboot
wget -O - https://skia.googlesource.com/skia/+archive/cd048d18e0b81338c1a04b9749a00444597df394/platform_tools/android/bin/linux.tar.gz | tar -zxvf - adb
adb version
sudo mv /usr/bin/adb /usr/bin/adb-1.0.31
sudo mv adb /usr/bin/adb-1.0.32
sudo chmod +x /usr/bin/adb-1.0.32
sudo ln -s /usr/bin/adb-1.0.32 /usr/bin/adb
adb version

http://bernaerts.dyndns.org/linux/74-ubuntu/328-ubuntu-trusty-android-adb-fastboot-qtadb

List

adb devices -l

Backup

adb backup -shared -all -apk -f ~/Backups/[device]-[date].ab

Flash without wipe

Download latest factory image: https://developers.google.com/android/nexus/images

tar zxf [firmware].tgz
cd [firmware]
unzip image-[firmware]/zip
adb reboot bootloader
fastboot flash bootloader bootloader-[firmware].img
fastboot reboot-bootloader
fastboot flash radio radio-[firmware].img
fastboot reboot-bootloader
fastboot flash boot boot.img
fastboot flash recovery recovery.img
fastboot erase system
fastboot flash system system.img
fastboot reboot

http://schnouki.net/posts/2014/08/13/flashing-a-stock-android-image-without-wiping-user-data/

Root

SuperSU: http://forum.xda-developers.com/showthread.php?t=1538053
ClockworkMod recovery image: http://www.clockworkmod.com/rommanager/

adb reboot bootloader
fastboot flash recovery recovery-clockwork-touch-x.x.x.x-xxxx.img

Then use the volume controls to select recovery mode. Once the recovery image has been booted, select install zip from sideload. Then push SuperSU to the device:

adb sideload UPDATE-SuperSU-vX.XXrX.zip
5th September 2015