Flashing TWRP on Samsung Tab2 10.1 using linux can brick your device
and I’m not responsible for any issues you might face.

As Samsung doesn’t have a “fastboot” mode but only “download” mode
you need Heimdall/Odin to flash TWRP onto the device.
As many members of my family have samsung tab2 tablet which are not getting
any updates from Samsung anymore they are getting slower and slower with
any app that’s updated.
As the tablets are in pefect working order and the problem is software related
it’s much better and cheaper to just replace the samsung OS with LineageOS to
gave them a second live 🙂

Put device into download mode (odin mode)
Power button and volume up (is the right side of the button)
Then push volume down (left side) and make sure the device says “Downloading…”

Now connect device by USB to your linux machine.

On your Linux machine:
sudo apt-get install heimdall
sudo heimdall detect
sudo heimdall print-pit --no-reboot

(Device might reboot without –no-reboot)
Go into download mode again

In the output of the ‘print-pit’ look for
“Partition Name: RECOVERY”

Use that as your partition name, sometimes it could be in small caps, then
use small caps.

sudo heimdall flash --RECOVERY twrp-3.1.0-0-p5110.img --no-reboot

Disconnect USB cable

Now reboot into recovery by using keep pressed the buttons power + volume down (left side)
your device will reboot after 10 seconds and as soon as you see the samsung name on the screen
release the power button.

You are now in TWRP recovery and “swipe to allow modifications” to sideload a custom rom like LineageOS.
Make sure you “wipe” all the partitions in addition to a “factory reset” as I had issues on one tablet
where the ‘system’ partions wasn’t properly ‘wiped’ and I had to ‘wipe’ it separately.

sudo ./adb sideload lineage-13.0-20170401-nightly-espressowifi-signed.zip
sudo ./adb sideload open_gapps-arm64-6.0-pico-20170405.zip