The Quickest and Dirtiest Introduction to UNIX Ever

Bill Eickmeier
bee@uwaterloo.ca

Introduction

This is just stuff off the top of my head - it is in no way complete, but will hopefully allow you to get started. If you have any suggestions for this document, or you notice any errors or omissions, or pitiful bad grammar talking stuff just send me an email message or stop by my office.

Some things are specific to watarts - things may work slightly different on other UNIX systems. Anyway, again, it's nothing fancy, but hopefully enough to get your started. If you make a printout, be sure to check this on-line version ocassionally to see if there are any changes/additions.

Files

UNIX filenames can be up to 255 characters. In order to stay out of trouble, a good rule of thumb is to create filenames using only letters (a..zA..Z), numbers (0..9) and a period (.) in order to make a filename more readable (it's probably a good idea to not include spaces in filenames. As well, stay away from characters such as:
        +"'`~-?*&(){}/\$#!<>*,;:[]
which only complicate things.

Also, file names in UNIX are case sensitive, as opposed to case-insensitive as they are on Windows machines. This can be a cause for confusion at times. [Lucas Cherkewski, 2012]

So, a valid filename might be something like 'this.is.a.very.long.name.for.a.file' - although you probably will use simpler filenames. UNIX also allows the creation and use of subdirectories much like MSDOS and similar to the Mac folders and subfolders.

Everyday Commands

Here's some of the more common commands you might use on a daily basis. Try each of them to see what happens (but be careful with rm(1)). All the manual pages for these commands are online - see the section 'Online Manual Pages' below. If I use something like 'rm(1)', it means that you can look at the online manual page for the command by typing 'man 1 rm', which will show you the documentation for the 'rm' command in section 1 of the online manual pages. Normally when explaining the commands, I'll surround the command in single quotes "'" - the single quotes aren't part of the command, so don't type them when you are trying things out.

Watarts also has a command called files(1) which is a full-screen file manager for UNIX. It seems pretty easy to use and will let you do many simple file manipulations quite easily. You can start it up by typing 'files' at the UNIX prompt. Be sure to try it if you are new to UNIX - it may initially make things easy for you until you learn how to do things from the command line. I wouldn't recommend though it if you plan on doing 'real' work...

Sending and Receiving Email

The simplest email program under UNIX is pine(1). To start the pine(1) program, simply type 'pine' at the UNIX prompt. The available options are listed on the screen for you to choose from - it's pretty straightforward but doesn't have the features of some other mail programs. If you'd like to experiment sending and receiving email, feel free to send mail to me, my email is bee@uwaterloo.ca. Pine keeps a menu at the bottom of each screen so you know exactly what commands are currently available - you can just press the corresponding letter to select the desired option. The only piece of magic to remember is that if you see something like '^X', it means to hold down the 'Ctrl' key and press the 'x' key.

Other popular mail programs available under UNIX are mail(1) and elm(1).

Text Editors

There are a bunch of different text editors available under UNIX. The simplest text editor running on watarts is the pico(1) editor (pine actually uses the pico editor by default when you are composing an email message). To start the editor, specify the name of the file you want to edit on the UNIX command line, by typing something like 'pico temp' which will start up the pico editor editing the file 'temp' (if the file 'temp' doesn't exist, a new empty file is created).

Pico(1) also lists the available options on the screen in the same way as the pine(1) mail program. The option '^X' means that you should hold down the 'Ctrl' key and press the 'x' key. Most of the options require you to use the control key.

Another more powerful editor is the vi(1) editor. Vi(1) is not quite as user-friendly as the pico(1) editor - the available commands are not listed on the screen. You should probably have a vi(1) manual or helpsheet beside you before you try using it. The vi(i) editor is much more powerful than the pico(1) editor, but the pico(1) editor is probably a better choice for the beginner. You probably want to learn vi(1) later if you plan on doing programming or a lot of text editing under UNIX. I have an online vi(1) tutorial which can be installed on your account if you'd like to learn it. As well, my WWW page (see below) various documentation on vi.

Online Manual Pages

There's a program called man(1) on UNIX which gives you access to all the UNIX commands available. For instance, to find out about the ls command, you could type 'man ls. You will see the first page of the description for ls with the word '--MORE--' in the bottom left corner. This means that there is more text available - you can simply press the spacebar for the next page, the [return] key for the next line, or the 'q' key to quit. You can also press the '?' key to get a list of available options.

A very useful feature of the online manual pages is the ability to look up keywords. You'll notice that each manual page has a one line description of the command it is describing. These one line descriptions can be searched using man(1)'s '-k' option. For instance, typing 'man -k mail' would display the names of all manual pages with the word 'mail' in the one line description. Be sure to use this excessively!!!

Printing Files

By default, anything you print on watarts will be sent to the ACO printers in PAS 1099. At the unix command line, you'll probably use the lpr(1) command to print a file. For instance, 'lpr myfile' would do the obvious. Your request to print the file called 'myfile' will go down to the ACO printers - in the printer room you will need to enter your userid and password in order to have the printer actually print your stuff. You may also print stuff directly to the Psychology Department's laser printers - there's a charge for this and we'll need to set up the accounting to allow you to print, so please see me if you'd like to do this. It's also possible to print to a printer attached directly to the computer you're working on - it depends on your setup so ask me about it.

WWW

There is a huge amount of information available on the World Wide Web (WWW) accessible with programs such as Netscape(1) and lynx(1). I can't begin to describe all the information available with these program, you are just going to have to try them.

Netscape is a much more powerful way of accessing information. With Netscape you can view text, graphics images, animations and even listen to sound files if you are at a machine which can support these. On most PC's with Windows and Mac's connected to the network in the department, you should be able to find an icon called 'Netscape' which you can just double-click on in order to fire it up. From a watstar account you can also start up Netscape from Windows. You can also run Netscape from the Xterminals in PAS 1080. If you are starting it from the UNIX prompt, just type 'netscape &' in order to fire it up. You should look at Netscape at least once to see what is available. Anyway, once you've started Netscape, you can use the mouse to single click on any highlighted phase in order to access the information it links to.

Lynx is a plain text version of Netscape - you'll want to run this you are at a plain terminal which doesn't support graphics or sound. Just type 'lynx &' to start it and press 'h' for help.

I've set up a WWW (World Wide Web) page called the "beeHive" (I tried changing the name, but people made me change it back) which contains a lot of information relevant to people in our department. There's various psychology related items and lot of information on the use of PC's, Mac's and UNIX machines as well as information available from IST. On most machines in the department, this is probably the default starting point for Netscape or Lynx. In case it's not on the machine you happen to be using, you just need to open the WWW URL http://watarts.uwaterloo.ca/~bee/

Network News

There's currently more than 8,000 newsgroups worldwide. There's a number of ways of accessing these newsgroups. The most efficient newsreader is probably trn(1). Check my WWW page for a tutorial on using trn. There's some magic to using trn efficiently so feel free to ask.

Another more straightforward newsreader is called tin(1). Currently it's not installed on watarts, but I've compiled my own version which you can access by typing '/u/bee/bin/tin' (you'll get a message once the ACO has installed the official version). Tin is very easy to use - just press the cursor keys to navigate. There's always a menu of commands at the bottom of each screen listing the available options.

As well, it is possible to set up Pine to read the network news as well as email messages. If you'd like to use it in this way, stop by my office for a moment - I'll need to change a few of your startup files to allow you to do this. Using pine for reading news is a good choice since you probably are already familiar with it and it's easy to use.

Transferring Files To and From Pc's and Mac's

For PC's running Windows, the easiest program to use to transfer files to and from a UNIX machine is Rapid Filer. Essentially you just enter the name of the machine you want to connect to (usually watarts) along with your userid and password. Two windows will appear, one the DOS file system and the other the unix filesystem. You can simply drag a file or directory icon from one window to the other in order transfer it to the other machine.

On Mac's, use Fetch. You simply enter the name of the machine you want to connect to along with your userid and password and simply specify the files or directories you want to put or get from the other machine.

If you are connecting from a UNIX machine to another UNIX machine, you'll probably use a program called ftp(1). Essentially, you might do something like this to transfer a text file called 'myfile' from your machine to a remote machine:

           ftp remote.machine.name
               - and enter your userid and password at the prompts
           dir
               - if you want to list the files on the remote machine
           put thefile
               - which will put the file (use 'get' to get a file)
           quit

FTP assumes you are transferring a plain ascii text file by default. Binary files (non-text files) such as word processing documents, or compressed files (zip, gz, etc) need to be treated specially. A good rule of thumb before getting or putting a file, is to either enter the word 'ascii' or 'binary' depending on the type of files you are transferring.

Most importantly, type 'help' at the ftp prompt for a list of command which are available. The above is in no way a complete description of FTP. The beeHive also has a tutorial for using ftp which you might want to check out.

Other Stuff

At some point, you might want to ask about other useful programs such as calendar(1), awk(1), grep(1) and screen(1) - or just check the online man pages yourself at your leisure

IST also provides courses on various UNIX topics throughout each term. These are announced in several places including the IST Newsletter and through Lynx or Netscape.

I suppose the most important thing to remember is that if something seems difficult, there's probably an easier way of doing it. There are a lot of powerful tools available under under UNIX, but because there are so many, it's sometimes tough to figure out exactly what will best do the job for you. Just ask and I'll try to get you moving in the right direction...

See Also

Here's a few more links of interest:

Jump to - beeHive - UW Psychology - UWInfo Home Page.
Last update: June 1996, bee@uwaterloo.ca