Setup wireless with command lines

My ubuntu box does not always configure wireless connection correctly. Luckily, setting connection on command line is rather easy. I followed the comment by Savage for this guide (or I guess this one is kind of the same). It didn’t work the first shot for me. But it worked after some slight modifications. You may have a different device,…