So you want to root your Galaxy S3 on Linux/Ubuntu? Using Heimdall, you can.
THIS IS ONLY FOR GALAXY S3 GT-I9300!
For Windows, please see How to Root Galaxy S3 on Windows!
For Mac OSX, please see How to Root Galaxy S3 on Mac OSX!
Step 1. Put your phone into download mode by holding down Volume Down, Center Home, and Power button together for about 10 seconds.
Step 2. When you see the warning sign, press Volume Up button to enter Download ODIN mode.
Step 3. Connect a microUSB cable from your Galaxy S3 to your Linux/Ubuntu computer.