Get adb and fastboot binaries for linux.
Get the latest TWRP recovery.
Hold down Vol down and Power button for a few seconds after powering on the device, until you get the following image:
You are now in bootloader mode.
If your screen shows a red text saying: “LOCK STATE – LOCKED”, unlock it as below:
Unlocking a Nexus 7:
Run fastboot in bootloader mode:
sudo fastboot oem unlock
Confirm by pressing the power button
When it says “Unlocked”, you can proceed
Rooting a unlocked Nexus 7:
You need to install a custom recovery.
In bootloader mode, run:
sudo fastboot flash recovery downloads/openrecovery-twrp-2.6.3.1-grouper.img
Now choose Recovery by selecting using the Vol up/down keys.
Once TWRP loads, select to reboot to recovery. TWRP will prompt you to root your device. Elect to do that.
Note: Everything on your device will be wiped at this point, and system boots as if for the first time.
Once device boots, enter the details asked for, and click Super SU installer in the menu. Update SU from Play store, and elect to root. On restarting your device, it will be rooted.
Joel G Mathew, known in tech circles by the pseudonym Droidzone, is an opensource and programming enthusiast.
He is a full stack developer, whose favorite languages are currently Python and Vue.js. He is also fluent in Javascript, Flutter/Dart, Perl, PHP, SQL, C and bash shell scripting. He loves Linux, and can often be found tinkering with linux kernel code, and source code for GNU applications. He used to be an active developer on XDA forums, and his tinkered ROMS used to be very popular in the early 2000s.
His favorite pastime is grappling with GNU compilers, discovering newer Linux secrets, writing scripts, hacking roms, and programs (nothing illegal), reading, blogging. and testing out the latest gadgets.
When away from the tech world, Dr Joel G. Mathew is a practising ENT Surgeon, busy with surgeries and clinical practise.