Monthly Archives: April 2013

Multiple terminals in a single SSH session

http://idnotfound.wordpress.com/2008/01/14/multiple-terminals-in-a-single-ssh-session/

When I sit to work, I am using linux terminals 95% of the time. And I tend to use lots of them. One for vim, another for compiling and testing, another for checking whatever files the program outputs, and so on… If you’re a multiple windows/tabs kind of guy (or gal, why not?) like me, you know what I am talking about!

Ctrl + Shift + N is my favorite shortcut ever on gnome-terminal, but when I am not physically on the machine but working via SSH, it is not nearly as fun. In fact, it is annoying as hell as it opens a new local terminal, and I have to log in again, go to the path I am interested in, and only then being able to do whatever I want to do (which, sometimes, is pretty quick and I end up closing the terminal, just to regret next time I need it again). Thankfully, I found a nice way to solve this!

 

Normal Use (under Linux)

Well, a friend of mine reminded me of cool switch that is ssh -X. What it does is enable X11 forwarding. In other words, it redirects to your local (from your point of view) computer all X/graphical applications you run remotely; that is, if you run, let’s say, gnome-terminal, it will show a terminal on your computer that is actually running on the remote (again, from your point of view) machine.

Ok, so what do I do with that? How about Ctrl + Shift + N? Cool, uh? 8-)

Enough stories, this tip is about opening multiple remote terminals through SSH and only having to log in once. What I do is:

$ ssh -X mylogin@remotemachine gnome-terminal
Password: ...
[Ctrl+Z]
$ bg
$ exit

Ok, that sounded complicated, so I’ll go over it line-by-line:

  1. The syntax for ssh is ssh [options] [login@]host [command]. So what I am doing is connecting with the -X switch, and running gnome-terminal remotely. If you provide a command like this, after the process terminates, the connection is closed.
  2. I enter my password to connect…
  3. By now, the terminal we ran remotely should pop on your screen. Go back to your local terminal and hitCtrl + Z to pause the ssh process. You’ll get a prompt back.
  4. On the prompt, type bg, which unpauses the paused process, but runs it on background.
  5. You now close your terminal with exit. It is important to use exit and not clicking on the close button from your window manager, otherwise the ssh process we sent to background will be terminated too, and your remote terminals will disappear. I’m not sure why, but it works like that.

Now you try it… It’s fun, isn’t it? But why, oh why haven’t I just gone with the ssh -X mylogin@remotemachine gnome-terminal & one-liner? Well, because I couldn’t type my password that way. I know there are ways to allow direct login without password, but I have never fiddled with that that’s covered in anoter post. In case you got direct login working, you could use the one-liner.

If you’re not much into GNOME, things should probably be just the same with other terminals. However, if you’re on a Windows machine… fear not, as you can use this too!

Modest Spec or Barebones Installation of Ubuntu

Source from: http://www.psychocats.net/ubuntu/minimal

If you have a low-spec’ed computer (64 to 128 MB of RAM, less than 1 GHz processor), you may have difficulty with a regular Ubuntu installation. You may, even if you have a higher-spec’ed computer want to create a minimal installation for other reasons.

Go to the Ubuntu Minimal CD Image page to get the minimal CD.

This guide will help you burn the .iso to CD

Note: a high-speed wired internet connection is recommended for a minimal installation.

Click to view larger image
On older versions, when you boot up, you may get a boot prompt. If that happens, just hit Enterthere.


Select Command-line install

Click to view larger imageClick to view larger image
After a short wait, you’ll be presented with a couple of easy questions. Use Tab to move between options and Enter to select the option you want to proceed with.

Click to view larger image Click to view larger image Click to view larger image
Ubuntu gives you the option to have your keyboard autodetected. I would advise against this. It’s a little involved with a lot of guesswork based on what letters you type on your keyboard. It’s easier to just select what keyboard layout you have.

Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger imageClick to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger image
More easy questions. If you don’t know the answer to certain questions, just go with the default.


Partitioning isn’t as scary as you might think it is. If you want to take up the whole disk with Ubuntu and erase everything you have on your drive now, choose the Guided – use entire diskoption. If you want to save what you have installed and carve out some space for Ubuntu, choose Manual. You’ll have to resize your current hard drive partition and then create a new partition for Ubuntu.

The rest of this tutorial assumes you’re using your entire disk. If you need help with partitioning, post a thread on the Ubuntu Forums.

Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger image Click to view larger imageClick to view larger image Click to view larger image
Lots of questions. Just as before, most of the questions are easy to answer. If a question is hard or confusing to you, just go with the default answer.

 
After you boot up without the CD, log in and you should be at a prompt that looks likeusername@computername:~$. So in this example, the prompt looks like susan@ubuntu:~$.

Click to view larger image
At the prompt, type these three commands (unfortunately, you won’t be able to copy and paste into the fullscreen terminal, so please be careful to type exactly what you see here; be mindful of the spaces and spelling):

sudo apt-get update
sudo apt-get install xorg xterm gdm icewm menu firefox gksu synaptic –no-install-recommends
sudo service gdm start

Click to view larger imageClick to view larger image
You should get to a graphical login screen.

Click to view larger image
After you log in, you should then see a very basic menu with at least a terminal.

After this minimal install (using Ubuntu 12.04 as an example for these screenshots), the total installation size is a little over 1 GB.

Making a bootable USB of Ubuntu

Source from: http://www.psychocats.net/ubuntu/usb

Introduction
If your computer can boot from USB, then you can save yourself a CD by using UNetbootin to “burn” the disk image (the Ubuntu .iso file) to USB. This method has the advantage of not wasting a blank CD and of getting a snappier performance during the live session, since USB can usually be read faster than optical drives.

As of Ubuntu 12.04, the .iso file sizes are now over 700 MB, which means you cannot even burn it to CD any more. You would have to waste a whole 4 GB blank DVD instead—all the more reason to “burn” to USB instead.

Things to know first

  • Your USB drive should be formatted as FAT32 or FAT16. It cannot be formatted as NTFS, HFS+, or Ext4. Most USB drives come formatted as FAT32 or FAT16 already, so this shouldn’t be a big worry.
  • Some USB sticks come with firmware that will prevent USB booting of Ubuntu from working. It’s called U3. You can read more about it (including how to remove it) on Wikipedia.
  • I’ve used this for USB sticks, a Sansa Clip MP3 player, and an SD card. It’s a pretty versatile boot method. Just make sure you have at least 900 MB of free space on the drive.
  • Most recently made computers can boot from USB. If you have to burn a CD or DVD, go tothe CD burning page. (As far as I know, Macs will not boot non–OS X hard drives from USB, so you will have to burn a CD.)
  • If your computer’s BIOS does not support booting CDs or USB, you may have to employ a workaround called PLoP. I’ve never used this before, and it looks complicated to me, so your mileage may vary.

Using UNetbootin

After you download UNetbootin, double-click it. The unetbootin-windows-###.exe file you download isn’t an installer file. It’s the actual program. Windows may prompt you to authenticate. Go ahead and do so.


You’ll then be presented with two options. You can either select Ubuntu from the distribution list and leave it up to UNetbootin to download the Ubuntu .iso for you or, if you already have the .iso downloaded, select the .iso yourself. (I’d recommend the latter option.)


Once you’ve done that, select the USB drive you want to “burn” the .iso to, and then click OK.


Most of the files will copy quickly to your USB drive. If you notice it stays a bit long on a file called filesystem.squashfs, don’t worry. That is a normal (it’s a huge file).


You can, of course, reboot immediately once it’s done.


Windows may tell you the program didn’t install correctly. Since you didn’t actually install a program, you can ignore the warning and just click This program installed correctly.


If you choose to wait on the reboot, you can take a look at the contents of your USB drive, and you should see a bunch of lowercase filenames like these.

Now your USB drive is ready to boot Ubuntu up!

To get your BIOS to boot from USB, you may have to press a special key right when you bootup (it could be F9, Escape, Delete, or F12, depending on what you have).

Note: If you’re using UNetbootin in Ubuntu 10.04 (and not in Windows), you may get an error message when you try to boot the USB stick. Instead of UNetbootin, use Ubuntu’s own built-in USB Creator application.