[Galaxy Tab 3 General] powermetza:
This was tested on a new Galaxy Tab T310 with Android 4.2.

#include
/*
* I am not responsible for bricked devices, dead SD cards,
* thermonuclear war, or you getting fired because the alarm app failed. Please
* do some research if you have any concerns about this root method and its risk.
* YOU are choosing to make these modifications, and if you point the finger at me
* for messing up your device, I will laugh at you.
*/

This could be complicated if you never used any Linux os, however with this method you can root your phone without increasing the flash counter.

Kernel, recovery, etc. will be the same as in original samsung roms, we will flash a modified (pre-rooted) system.img.

You can find my pre-rooted system image here.

Requirements: Linux - distributions based on Debian: Ubuntu, Kubuntu, Mint ( I used Linux Mint Mate 32-bit in VirtualBox).

1. First of download your original 4.2 firmware

2. Download Ext4Utils from here (ext4_utils_new_cygwin_fixed.tar.gz) and extract the files in /Desktop/ext

3. Open terminal and run the next command: sudo apt-get install zlib1g-dev

4. Extract system.img and cache.img from you firmware in /Desktop/ext

5. Open terminal and run the next commands:

cd Desktop
cd ext
make
sudo mkdir /mnt/system
sudo mkdir /mnt/cache
sudo mkdir /mnt/system

6.The next commands extract files from cache.img in /mnt/system2

mv cache.img cache.img.ext4
./simg2img cache.img.ext4 cache.img
sudo mount -o loop cache.img /mnt/cache
sudo unzip /mnt/cache/recovery/sec_csc.zip -d /mnt/system2/
sudo umount /mnt/cache

7.The next commands mount system.img in /mnt/system

mv system.img system.img.ext4
./simg2img system.img.ext4 system.img
sudo mount -o loop system.img /mnt/system

8.Find su and supersu.apk on xda (I copied the files from my phone), and copy them in /Desktop/ext and run the next commands:

sudo cp su /mnt/system/xbin/su
sudo cp superuser.apk /mnt/system/app
sudo chown root:root /mnt/system/xbin/su
sudo chmod 06755 /mnt/system/xbin/su
sudo chmod 0644 /mnt/system/app/superuser.apk
sudo cp -r /mnt/system2/system/VODB /mnt/system/VODB
sudo cp -r /mnt/system2/system/sipdb /mnt/system/sipdb
sudo cp /mnt/system2/system/CSCVersion.txt /mnt/system/
sudo cp /mnt/system2/system/SW_Configuration.xml /mnt/system/

9.Copy from your tablet with rootexplorer (or another app like that) csc and csc_contents from /system (you can copy then without root) and put them in /Desktop/ext and run the next commands:

sudo cp -r csc /mnt/system/csc
sudo cp -r csc_contents /mnt/system/csc_contents

10.Now you can rebuilt system.img with the next command:

sudo ./mkuserimg.sh -s /mnt/system ./system_mod.img ext4 ./temp 2000MB
sudo umount /mnt/system

11.The next step is to prepare system.img for Odin; rename system.img from /Desktop/ext/ and rename system_mod.img in system.img and run the next commands:

tar cf system_rooted.tar system.img
md5sum -t system_rooted.tar>>system_rooted.tar
mv system_rooted.tar system_rooted.tar.md5

12.Flash system_rooted.tar.md5 with Odin as PDA or AP.

Edit:

Because we have root, we can flash recovery with dd command WITHOUT increasing the Flash counter.

I flash PhilZ recovery with dd if=/sdcard/RECOVERY.img of=dev/block/platform/dw_mmc/by-name/RECOVERY and CURRENT BINARY: Custom.

So WITHOUT increasing the Flash counter, only ROOT is possible .