Topics Map > University of Chicago > IT Services > Applications, Operating Systems, & Devices

Basic Unix - Getting Started

This article explains how some of the basic concepts and commands of the Unix operating system so that you can begin using your account on our Server Cluster.

Unix is a widely-used operating system which does some things (like multitasking and networking) more powerfully than personal computers can. IT Services provides Unix services to the University community from "harper" which is part of our Server Cluster.

All faculty, registered and enrolled students, and benefits-eligible staff may activate accounts on the cluster. If you would like to activate your account go to http://cnet.uchicago.edu or stop by the Identification and Privileges Office at 1100 East 57th Street, Room 100F (in the Regenstein Library) with your University of Chicago identification card. Accounts are issued from 9:30 a.m. to 4:30 p.m., Monday through Friday.

Opening the Connection and Logging In

  1. Launch a telnet application to open a connection to the Server Cluster. SSH Secure Shell is a telnet client included in the Connectivity Package for both Windows and Macintosh.
  2. Note:some of the commands and pictures listed below may vary depending on which telnet application you are using.
  3. Click on the "File" menu, then select "Open Connection". This will bring up a dialog box.
  4. In the "Host" field, enter the complete address of the machine you are connecting to.
    For example:
    harper.uchicago.edu
  5. Click on the "OK" or "Connect" button to establish your telnet session. A Unix window, sometimes called a "terminal," will appear on your desktop.
  6. At this point, you will be prompted to login. At the "Login" prompt, type in your Unix account name and press the Enter (Windows) or Return (Macintosh) key.
  7. At the "Password" prompt, type in your Unix password and press the Enter or Return key (for security reasons, your password will not appear on the screen as you type it).
  8. If you have entered your account name and password correctly, you will then see a welcome message from IT Services, followed by a prompt like this one:
    TERM = (vt100)
  9. Unix is asking you to select a terminal type (vt100 and vt220 are two common ones).
    Just press the Enter (Windows) or Return (Macintosh) key to accept the default terminal.
  10. You may be prompted to read the "system messages." If a message appears, type "y" (or hit the space bar) to read it. (You can also type "n" to skip it, or "q" to postpone reading it until later.)
  11. You will now see a Unix prompt indicating that Unix is ready to receive a command:
    harper:~>
  12. (This prompt will vary depending on which machine you have logged in to.)

Interacting with Unix: The Command Line

A Unix command is generally a short word in lowercase letters. In many cases, a command will look as though its vowels have all been kidnapped -- cp, mv, ls, rm, cd, and so on. (Unix was written in a less kind-and-gentle age, when vowels required great effort to type.) Please note that Unix is case-sensitive! The syntax of most commands is:

command -options [arguments]

Here, "command" is the name of the Unix command; "options" allow you to specify exactly how the command will work; the "argument" is the information that will be effected by command (usually a file or directory name). The parts of a Unix command line must be typed in the order specified above and be separated by spaces. Options are always preceded by a hyphen (also called a flag) and can usually be listed in any order.

Many commands do not require you to specify options or file names, because they assume defaults. Commands which do allow options generally offer quite a few.

Example: the "man" Command

The man command displays information from the Server Cluster's online manual -- also called the "man pages." The "man" command requires the name of the command you want more information for as an argument. The "passwd" command lets you change your password To see the "man page" for "passwd," type:

man passwd <ENTER>

Press the space bar to progress through the explanation screen by screen.

The "k" option for the "man" command lists all commands relating to a specified term. To see all commands
relating to "password," type:

man -k password <ENTER>

In this example, "man" is the command, "k" is the option, and "password" is the argument. Consult the "man page" on any command to see what arguments and options you can use with that command. (There is even a "man page" for the "man" command.)

Looking Around

Unix is structured like a tree. The "root" of the tree is indicated by a forward slash, / . The root contains a number of branches, called directories. Directories can contain both files and subdirectories. Your home directory is located on one of these branches.

Where am I? (pwd)

To find out which directory you are in at any given time, type:

pwd <ENTER>

If you are in your home directory (as when you first log in), you may see something like this:

/nfs/harper/e2/myname

Note the machine your account is located on (in the example above, the account "myname" is located on "harper"). For best results, always log into the machine where your home directory is assigned.

Listing files (ls)

To show what files are contained in a specified directory, use the "ls" (list files) command. Options for the "ls" command include: "l," to show more detailed information about each file; "a," to show all files (files that have names starting with a period will not normally show up in an "ls" listing); and "F," to mark directories and executable files.

To show a long listing of all files in the current directory with subdirectories and executable files marked, type:

ls -laF <ENTER>

Moving around (cd)

To connect to other directories, use the "cd" (change directory) command. To move to a directory called /usr/local/doc (a public directory elsewhere on the system), type:

cd /usr/local/doc <ENTER>

To list the files in this directory, type:

ls <ENTER>

Some of the files in this directory are actually subdirectories that you can "cd" into and some are files which you can read or copy to your own directory. The default assumption on the Server Cluster is that unless permissions are set otherwise, you can connect to any directory and read any file, except for private mailboxes. And in fact, you can learn a great deal about Unix just by connecting to various directories and listing their contents. Out of respect for others' privacy, however, you should limit yourself to system directories and files unless you are certain that the person whose directories you are looking at actually intended for others to see his or her files.

To return to your home directory from any other location, type:

cd <ENTER>

Reading files (cat and more)

The "cat" and "more" commands display files on the screen. The simplest of these, "cat," lists the entire file without stopping. The "more" command displays a file screen by screen. To read a file in the directory /usr/local/doc called getting-help, type:

more /usr/local/doc/getting-help <ENTER>

Managing Files and Directories

Unix has a series of commands for copying, moving or renaming, and deleting files. It also has special commands for creating or deleting directories.

Creating directories

To create a subdirectory within your home directory, use the "mkdir" command. For example, to create a directory called Information, type:

mkdir Information <ENTER>

Copying files (cp)

The cp command makes a copy of a specified file. To copy /usr/local/doc/getting-help to a file in your home directory called myhelp, type:

cp /usr/local/doc/getting-help myhelp <ENTER>

Note: if the file name you specify for the new file already exists (in this case, "myhelp"), it will be overwritten by the file you are copying; "cp" has an "-i" (interactive) option which will warn you before overwriting files:

cp -i firstfile secondfile <ENTER>

Renaming and moving files (mv)

A Unix file is renamed by "moving" it from one file name to another using the "mv" command. To rename the file myfile as MyHelpFile, type:

mv myfile MyHelpFile <ENTER>

You can also move a file from one directory to another. To move the file MyHelpFile to the Information
directory, type:

mv MyHelpFile Information <ENTER>

The "mv" command works exactly like "cp," except that the original file is deleted. Like "cp," "mv" has an "-i" option which will warn you if a file with the name you have indicated (in this case, MyHelpFile) already exists.

Deleting files (rm)

To delete a file or files from a directory, use the "rm" command.

Before you start experimenting, however, be aware that "rm" removes files permanently. Unless you are certain that the file is on a system backup (it is older than a week, say, and you have not touched it since), you should treat "rm" with a great deal of caution. To remove the file MyHelpFile from the Information directory, type:

rm -i Information/MyHelpFile <ENTER>

Deleting directories (rmdir)

The "rmdir" command removes a directory. Only empty directories can be deleted. To remove the directory Information, type:

rmdir -i Information <ENTER>

Ending Your Unix Session

  1. At the Unix prompt, type:
    logout <ENTER>
  2. To close the telnet application, click on File menu, then select Quit.



Keywords:operating system command line   Doc ID:15865
Owner:Larry T.Group:University of Chicago
Created:2010-11-30 18:00 CSTUpdated:2015-01-05 06:21 CST
Sites:University of Chicago, University of Chicago - Sandbox
Feedback:  0   0