Date: Wed, 08 Jan 1997 21:31:20 GMT
Server: NCSA/1.4.2
Content-type: text/html
Using UNIX
Using UNIX
a brief introduction
Executive Summary: This document is designed to help you get
started on UNIX. It assumes that you're not completely stupid about
files and directories and such. It will only tell you the very most
basic-est things.
Introduction to UNIX
UNIX is an operating system. It likes to use short two-letter
commands for most things. When you ask it to do stuff, it doesn't
usually prompt you to make sure you're sure. It also doesn't print
much back at you unless there's an error.
Most UNIX commands take arguments which are specified after the
command -- often with a "-".
File basics
The current directory is called "." The parent directory is referred
to as ".." Your home directory can be referred to using "~". The
root directory in UNIX is simply called "/". Files can be specified
using slashes between directory names. For example, I can refer to a
file named foo in my home directory as "~/foo".
Paths that start with "~" or "/" are absolute pathnames because they
refer to a specific starting point. Other paths are relative, and
constructed starting from the directory you're in. The example above
was absolute and will work no matter where I am. In contrast,
"../foo" will go back one level from the current directory and look
for foo. Here are some useful commands:
- pwd
- prints the working directory you're in.
- cd name
- changes you into the the named directory.
- ls
- lists the files in the current directory. Subdirectories
are marked with a "/". ls -l gives you the long version
including the dates the files were created, their sizes, and
plenty of other stuff that won't be important. ls -a lists all
the files in a directory. Filenames which start with "." are not
printed otherwise. ls name lists the contents of the
named directory.
- cp name new-name
- copies a file to a new name or location.
- mv name new-name
- moves a file. If new-name is a
directory, the file will be moved to that location. If it is a
filename, it will be renamed to that name.
- rm name
- removes a file (No warning!).
- mkdir name
- makes a new directory.
- rmdir name
- removes a directory.
Looking at files
The best way to look at a file (short of firing up an emacs session),
is to use more. This will display the file one screenful at a
time. Between screens, you can hit q to quit, RETURN to
advance one line, or SPACE to advance to the next screen. You
can also search for text using /text-RETURN.
Using the shell
The shell is the command interpreter that you interact with in an
xterm. On the mscc machines, you'll be using a shell called tcsh.
You can re-run the previous command using !!. You can re-run a
command starting with a particular substring using
!substring. You can see a list of the recent commands
you've typed using history
You can also re-edit previous commands by using the arrow keys to
scroll through them. The MSCC machines seem to be set up in such a
way that this isn't completely straightforward. Type bind
emacs to make it work intuitively. Put this line in your .cshrc
to have it be run automatically for you at every login (.cshrc
contains commands that will be run whenever a new shell is
started).
On-line help
On UNIX, every command has an on-line manual entry, which is a very
terse but complete description of what it does. Access these entries
by typing man command. You can also use apropos
substring to get a list of commands which contain a given
substring.
Telnet/rlogin
You can get access to other UNIX machines remotely using telnet
machine or rlogin machine. For example, to
access your MSCC account from a departmental machine, you would use
rlogin mscc.ms. In this way, you'll never have to leave the
comfort of Sieg Hall. If your user name is different on the MSCC
cluster, you can use -l username to specify what your
name is there.
Printing
To print text files in UNIX, use enscript. Specify the printer with
the -P flag, and use -2r to save paper. I also use -G to get the
"gaudy graphical" look.
Conclusion
Those are the most basic basics. This should tell you what you need
to know to get through these assignments. For the most part, you
should be working within emacs, which has been documented elsewhere. Feel
free to ask questions if you have questions about UNIX that aren't
covered here.
Shamelessly stolen from cse341 Winter '96
cse341-webmaster@cs.washington.edu
(Last update:
03/22/96 at 02PM
)