Nexus 7: Unable to install factory image, stuck in I want to restore factory android on my Nexus 7 2012 WiFi.

I'm following the official guide.

I start the device in fastboot mode by executiong:

adb reboot bootloader


This works well.
But when I run any command that uses fastboot the execution gets stuck, eg:

$ fastboot oem unlock
&lt; waiting for any device &gt;


The same issue with flash-all.sh.

I also noticed that if I run 

adb devices


it doesn't list the tablet. However it gets listed if I run the same command after entering Recovery Mode (I have TWRP recovery).

More details/preconditions: I used to have CianogenMod on the device but I smashed it by mistake (I removed Android in recovery mode instead of simply wiping the data). I can't find the CianogenMod image anymore on LinageOS site (there is only Nexus 2013 available) so I'm trying to install at least what is available.
Well, the device is detected in ADB only, you probably haven't installed fastboot drivers. &lt; waiting for any device &gt; means that the computer is waiting for a device in fastboot mode. 

Download the drivers from this page then install. fastboot oem unlock should work now.

Learn the difference between these two protocols (ADB and Fastboot).

This question may also help.