UNIX commands: UNIX intro page 2

Getting to Pico

Your goal is to edit HTML with a simple text editor on a Unix system. To do that, you have to login, change to the right directory on the server (using the "cd" command), view lists of files (using the "ls" command), and launch a text editing program. We'll use one called Pico. Then you will type your code, save the file, and set its permissions so that people can see it. (At Radford, you can set permissions from the MyRU "My Accounts" page, but on most other systems you should know about the other "Going Public" techniques linked to the bottom of this page.)

With a PC and a program like PuTTY, or the Macintosh terminal program, login with your usual user name and password as described on the previous page.

The first time you connect from a new computer, you will get a screen message to "OK" storing the SSH connection information.

You also may get an intermediary prompt like "TERM = (xterm)" -- which is asking whether you are using a standard "XTERM" style terminal, which you are. Press Enter.

If it says TERM = (ruterm), type "xterm" or "vt100" before you press Enter.

Note: Older RU accounts (pre-2010) may give you a menu-like startup screen
of numbered choices. If so, choose Option 9 (Exit to C Shell)

When you are successfully logged in, you will be at the UNIX command line or "shell prompt," with a bottom line that looks something like this:

ruacad @ /home/yourname/ >

If your bottom line just says ">", you need to restore a missing configuraton file.
Type this line:

   /usr/local/bin/getdotfiles
And press Enter... Then type "exit" to log off; then log back on.

The key you use to "enter commands" in Unix is marked "Enter" on some keyboards, "Return" on others -- or both.

Commanding Unix

cd -- To move from one directory (folder) to another and see its contents, you will use the Unix cd (change directory) command... then

ls -- meaning "list files."

First, type "cd public_html" (without the quote marks) to go from the home directory of your H-drive space to your public_html folder.

This is what the command-line prompt looks like when I go to the public_html directory, my "www.radford.edu/~rstepno" Web space, and then type the "ls" (list files) command.

ruacad @ /home/rstepno/> cd public_html
ruacad @ /home/rstepno/public_html >
ruacad @ /home/rstepno/public_html > ls

After you type "ls" and press enter, the terminal window will show a list of all the documents and directories. There's more about that file list display on the next page of this tutorial, "Going Public."

For now, just notice that UNIX uses the slash mark / to indicate a directory.

Common commands:


For our quick intro to UNIX, we will edit Web pages using a common UNIX editor called "pico." If you are familar with another UNIX editor, such as emacs or vi, feel free to use it. One benefit of pico is its simplicity -- all of the main editing commands are visible at all times in a menu at the bottom of the terminal window.

You can run the program first, then open or save a document, or you can run the program and open a document at the same time. Here's how:

First make sure you are in the directory where you want the document, as explained above. Check your command line.

This should be the command line "prompt" when you are working in your course folder:

ruacad @ /home/yourname/public_html/coms326 >

Launching Pico

Editing with Pico

For more about Pico, see another Dr. Bob, who has a whole site full of Unix/Linux classes

Shortcuts: The UNIX command line has two useful shortcut keys built in -- the tab key and the up-arrow key.

The up-arrow key will step backward through commands you have typed recently. The tab key will auto-complete all or part of a command. That is, if you type "pico m" (on the way to "pico myfile.txt") and press the tab key, the system will finish typing for you, if that is your only file beginning with "m." If you have both "myfile.txt" and "myfile.html," the tab key will get you only the "myfile." part of the name -- you will have to finish adding the "txt" or "html"

Editors: Most UNIX computers, including the ruacad computer, have other editors, but pico is probably the simplest, because its basic control key commands are always visible on screen. Other popular UNIX editors include nano (based on pico), vi or vim, and emacs or xemacs.

Next: Going public | Back: UNIX intro page 1


updated Jan 18, 2013