Just a little UNIX (and computer history)
for COMS 326 Web Production students
by Bob Stepno
Most Web pages these days are created with Content Management Systems or dedicated Web page editors like Adobe's Dreamweaver or Apple's iWeb. However, you also can edit your http://www.radford.edu/~yourusername Web (HTML) pages with the simplest of text editors, even edit them directly on the Web server, which is a UNIX computer somewhere across campus. At Radford, you get there by connecting to your "H drive" or "Home" space using a terminal program. This page of mine tells you how.
On any Macintosh, the terminal program is actually named "Terminal." On campus Windows machines, you can use PuTTY, a free program you can download for your own PC, with online documentation and FAQ file to get you started. (Why the weird name? The letters TTY are the old abbreviation for "teletype" the original online terminal. I don't know about the "e;Pu"e; part, other than that it's the symbol for plutonium, and that those two letters make the name a pun related to windows.
With both Mac Terminal and Windows PuTTY you use the Secure SHell protocol, SSH, to safely connect with the remote computer or "host." SSH is built into PuTTY; on the Mac, SSH is a program you run within the terminal.
To login to the system, combine the "host name" with your Radford computer system username (rstepno for me). Follow that with the "@" sign, the name of the host (server) you are connecting to (ruacad -- or rucs for computer science students), and its domain (radford.edu).
- From the Macintosh Terminal program, the command to
After that, you are prompted for your password (for security purposes, nothing will show on screen while you are typing; just type the password and press Enter.)
You also will be prompted to accept or change the terminal type. (Just press Enter to accept the standard terminal. Either xterm or vt100 is fine with the main program we'll use in class.)
- With PuTTY, enter "firstname.lastname@example.org" in the "Host Name" box and select "SSH" as the "Connection type." It will prompt for your password. (If you just type "ruacad.radford.edu," it will prompt for your username, then for your password.)
Either TTY/Terminal program opens a plain-text window on your screen. You can cut and paste plain text between other Macintosh or PC applications and the terminal. On a Mac, it's easier because the "command" key handles cut-and-paste shortcuts between programs just the way it does within a single application like Word. On a PC, see the item a.6.6 Copy and Paste in the PuTTY FAQ file. You can not use the standard Windows control-key shortcuts to cut and paste between applications, because the control key has special uses within the terminal itself.
On the Mac, you can make the terminal window and its type larger or smaller by holding the "command" key and pressing "+" or "-" (plus or minus). See PuTTY's setup screens for more information there.
Underneath its fancy desktop, each of our lab Macintoshes is actually a UNIX computer with the OS-X user interface running "on top" of UNIX. "Terminal" takes you to the UNIX level of the Macintosh, where you can use UNIX tools to create or delete documents and folders, run programs on the Mac, or connect to other UNIX computers on the Internet.
Getting and Putting Files
A graphical file transfer program like Filezilla or the MyRU Files tab makes file transfer easy, but you also can use UNIX command-line utilities to copy documents between the Macintosh and the RUacad file server. Two common utilities to securely copy are "sftp" and "scp." You run them like the "ssh" secure login program, by combining the program name with the server name, after which you are prompted for your password.
An SFTP sample:
- Giving the command "sftp email@example.com" and responding with your password will produce an "sftp>" command-line prompt. It accepts UNIX file and directory commands, such as CD and LS, as well as the sftp commands "put" and "get." Type "ls" to see the contents of your working directory on the server.
- Use the CD command to navigate to the folder where you want to place the file you created on the Macintosh (such as "cd public_html/coms326" to get to your course folder).
- Type put Desktop/filename.html and press Enter to copy a file from the Mac's desktop to your current folder on the server. (You can give more complicated folder locations or paths, but working from the desktop of a lab computer is easy and convenient.)
- Want to copy more than one document from the Mac to the server? Easy. The asterisk "*" is a "wildcard" that can represent the names of multiple files. Use sftp and "cd" to navigate to the folder where you want to put the files. On the Mac, drag the files you want to transfer into a folder on the desktop with an obvious name like "send." Then give sftp a command like "put Desktop/send/*"
- In case you haven't deduced it yet, if "put" copies things from the Mac to the server, there is also a "get" command to copy files from the server to the Macintosh.
- Navigate to the directory containing that file,
- then type "get" plus the filename, followed by the destination folder path and filename:
get mypage.html Desktop/mypage.html
- That combination copies the document "mypage.html" from the current folder on the server to the Mac's Desktop, keeping the same file name.
- Here's a USC info page on SFTP with more details.
- CAUTION: Because every folder on a website can have an "index.html" document with different contents, be very careful when copying files from folder to folder, especially when you are new at using file transfer tools. Rather than risk replacing the wrong "index.html" page, give the file you are moving a temporary name, such as "today'sdateindex.html" before you move it. Next, rename the old version something like "yesterday's date.html." THEN make the move. Finally, when you are sure everything is in the right folder rename the new version "index.html" to put it into service.
An SCP sample: A friend who uses Unix more than I do warns that the SCP command can be tricky for beginners, especially when used with more than one file at a time. This SCP instruction page at Presbyterian College seems to agree with him. For a local example, this command syntax would copy the file from your Home directory on the Mac to the Home directory of your server space (your H drive). The punctuation must be perfect, and your username must be in two places in the command, once to prompt for your password and once to locate your home folder.
scp name-of-file.html firstname.lastname@example.org:/home/yourusername
Recap: The Web server that we see as http://www.radford.edu and the personal storage space we all see as an "H drive" is a server called "ruacad" when we connect with a terminal.
- Your H-drive is a folder with the same name as your e-mail account.
- Your public Web space is a folder inside that one, named public_html.
- To get to that public space from anywhere on the Web, your family and friends should point their browsers to http://www.radford.edu/rstepno, substituting your e-mail name for mine.
- The work you do for this class will go in a subfolder named "coms326" -- which everyone can reach at your version of the address http://www.radford.edu/yourusername/coms326
Next: UNIX Commands, then Going Public
Macintosh confusion alert: Radford's computer network uses your e-mail username for two different workspaces -- your H-drive folder out on the network AND your personal folder on whichever lab computer you are using.
Unlike a Windows computer, the Macintosh does not mark the network folder with an "H:"
Learn to recognize which "myusername" folder you are working in! If it has a house-shaped icon, it's the Macintosh folder, not your H-drive. See my Macintosh tips.