[Samsung Galaxy Nexus] loveubuntu:
warnning: any damage you do to your phone following these directions is your responsibility. Assume you warranty is void if your are rooted.

I used the information koush provided here and info birdman provided here and adopted it in Ubutnu Linux 11.10. I hit some bumps along the way using my Linux box so I decided to write this for those of us not using OS's made by the darkside ;) This should also work with Ubuntu 12.04 LTS just fine.

All this should work with Linux Mint 12 also.

1- Set up Android SDK, adb, and fastboot in Ubuntu Linux using the links in my signature. I can't stress how useful and easy it is to set adb and fastboot in your "path" so you can easily use it from any prompt. The links explain it. Take your time with that and it will payoff for all your devices. Here is the guide I wrote http://xdaforums.com/showpost.php?p=19446284&postcount=62

STOP NOW! EVERYTHING INCLUDING YOUR PERSONAL FILES, PICTURES, AND VIDEOS WILL BE ERASED WHEN YOU UNLOCK/ROOT THIS DEVICE. It does not have a physical SD card. Very annoying. Use Dropbox or Google+ to backup everything.

2- on your phone, go to settings/Developer Options and check the box for USB Debugging

3-connect your phone, fire up a terminal, and type:

adb devices

You should get the serial number of your device appear. If not, unplug, reboot phone, re-attach the phone to your computer and try again. If you still do not get your device's serial number, go back to step 1 and make sure everything is setup correctly.

4- Now download Clockwork Recovery from here

http://download.clockworkmod.com/recoveries/recovery-clockwork-5.5.0.4-toro.img

(make sure it's the CDMA one (toro). The GSM one is called maguro and steps should be the same)

and su.zip from here

http://download.clockworkmod.com/test/su.zip

5-Turn the phone off, hold both Volume up and Volume Down and press the power button. You should come to a screen that has a big arrow and some writings at the bottom (fastboot). Last line should say Locked state.

6- Connect your phone to your computer, fire up a terminal and type:

fastboot devices

your phone and its serial number should appear just as it did using adb above. adb will not work here of course. If you don't see your device, go to step one. I guess you can download the fastboot for linux and cd to that directory and do it but I like to have it setup on my computer.

STOP NOW! EVERYTHING INCLUDING YOUR PERSONAL FILES, PICTURES, AND VIDEOS WILL BE ERASED WHEN YOU UNLOCK/ROOT THIS DEVICE. It does not have a physical SD card. Very annoying. Use Dropbox or Google+ to backup everything.

7- Now for the stuff that voids your warranty: Type

fastboot oem unlock

and enter. Look at your phone now, use the Volume up to choose YES and press the power button to accept. It should say that you are unlocked and fastboot is in good state.

9-use the volume up to change the value appearing in the arrow to recovery and press the power button to accept. You are taken to laying down android with a red triangle. This is the stock recovery. Now carefully press the volume up, volume down, and the power button to get to a menu. Choose wipe data and factory reset. 2 things: I had a hard time getting to the menu. Do it a few times and try pressing the power button JUST a fraction of a second earlier than the 2 volume buttons. Also wiping and resetting takes a few minutes, be patient.

10-you are now unlocked. Turn the phone off ( I pulled battery), go to fastboot screen by holding volume up, down and power button. Connect your phone to your computer and make sure it is recognized by typing:

fastboot devices

If it is, change directory to where you downloaded clockwork recovery. If you didn't change it, it should be the Download directory (remember it's case sensitive):

cd Downloads

11- Time to re-write your recovery:

fastboot flash recovery recovery-clockwork-5.5.0.4-toro.img

Please make sure you use common sense here when it comes to file names. If the file you downloaded has a different name or version, change it in the code above. I guess you can put the fastboot file in that location also to be used if you do not have it setup as in step 1. I'm not positive how and if that would work. Downloading and installing the wrong file is a mistake that may cause harm to your phone.

12- Use the vol up/down to point the big arrow toward recovery, push the power button to get to Cloclwork Recovery. Once you confirm you have CWR, reboot the phone normally and let Android OS create all the folders it needs. Once at start up screen, pull the battery to turn phone off, and then get to bootloader by holding vol up/down and power button in. Use the vol up/down to point the big arrow on sceen toward recovery. While in recovery, make sure your terminal prompt still shows the Downloads directory (or where the su and recovery files were downloaded to). Now type: (note the space between zip and /data)

adb push su.zip /data/media

this will put the su.zip file in the root of your virtual sd card.

You are still in recovery, reboot into recovery to refresh the file list by typing this

adb reboot recovery

Now go ahead and install su.zip through clockwork recovery's menus. Pretty self explanatory (choose zip from sd card). The su.zip should be now in the root of your virtual sd card.

That's all. You are now unlocked and rooted. Reboot. Make sure you install the paid versions of rom manager, titanium backup, and update superuser app.

13- Download Rom Manager and flash the recovery again (top choice). This will erase the install-recovery.sh file and keeps your CWR at each boot. You do not have to do step 14 if you do this. I will leave step 14 here just in case someone needs it.

14-When you are back in the fastboot screen. DO NOT reboot the phone here. There maybe a file that re-writes the recovery to stock if the phone is rebooted. Your phone may or may not have this file. of the two GN I have, one did and one did not at this step(may have been erased). The file is reovery.sh and is located in /system/etc/ . You need to either rename it or delete it.

While in fastboot and after you flashed CWR, use the Volume up and Down to change the arrow's value to recovery and press the power button. You should now see the familiar Clockwork recovery. In recovery, you can use adb (you can't in fastboot of course). You need to rename that file, use these steps in terminal: (If you see no file/folder found message, you know you do not have this file)

adb shell

mount -o rw,remount /system

mv /system/etc/install-recovery.sh /system/etc/install-recovery.bak

step 1 fires up adb, step 2 allows you to change permissions and read and write, and step 3 renames it. You can now unplug the phone.

Again, you can also get rid of this file by flashing the clcokwork recovery in Rom Manager or using the paid app root explorer to rename the file.

Once again referrence links:

http://rootzwiki.com/topic/12013-welcome-to-rootzwiki-editionstep-by-step-oem-unlock-and-root/

https://plus.google.com/103583939320326217147/posts/1Jsh9xPwnQP