Vi, SSH, and Other Goodies

Written by Liz Couture

Well, by now you should know some basic things you can do with the command line. Now is where we add a few more interesting things you'll probably use at one time or another while you're at Clark that have to do with the Linux terminal. Don't worry if you don't find the connection between the topics discussed in this module. They really aren't directly related to eachother at all. Just some things that you should know about.

Vi

Vi is a text editor that is executed from the command line. It is incredibly useful. First of all, since it is executed from the command line, it makes it really easy to make fast changes to documents while you're browsing through folders, or through SSH (we'll talk about that later). Also, it's pretty great if you're lazy, because it's designed so that you can quickly navigate your document without ever reaching for the mouse. You generally don't even have to leave the home row. It's an ideal program to edit code in, but it takes a little getting used to. So let's get started.

Basically, you get started by typing into the command line "vi the-name-of-the-file-you-want-to-edit". If you want to make a new file, that's fine. Just type what you'd like to name the file. There are two modes in Vi, insert mode and command mode. You can get into command mode from insert mode by pressing the escape key. You can get from command mode to insert mode by pressing the "a" key.

There's a bunch more on other specific commands, but it would probably be a lot more productive to point you to a better tutorial, specifically about Vi. Like anything else in Linux, you can find out a lot about Vi by searching on google.com/linux. But I found this site to be particularly good. Read through it and figure things out. You don't need to do the whole thing now, but when you're done, you should be able to:

SSH

Quite simply, SSH is extremely useful. It stands for "Secure Shell" and it's a simple way of connecting to another computer remotely. If you're in the lab and want to connect to another computer without walking over there, you can simply enter the command, "ssh computername" You can also replace the computer name with its ip address. For more information, there's a great tutorial at www.suso.org/docs/shell/ssh.sdf   And of course, if you can access a lab computer from another lab computer, you can access a lab computer from your home computer. That's what you're most likely to want to use SSH for. The Clark CS department provides a great tutorial for it here:

 http://cs.clarku.edu/resources/remote_connect.shtml

Things you should know how to do:

 

Piping

Another great tool available in Linux is the ability to "pipe" commands. Piping involves passing the result of one operation to another operation. The general syntax looks like this: command1 | command2 For a great example, try the dmesg command. It repeats the startup messages that scroll when Linux is booting. It makes lots of output, and it's hard to fit it all onto the same screen. The command "less" takes a lot of information and lets you view it one screen at a time. So, try typing "dmesg | less" You can then press the spacebar to flip through screens.

Things you should know how to do: