Introduction to UNIX

Getting the most out of the Physics and Astronomy computers will require at least a little knowledge of UNIX. Don't worry, it's painless.

Here are some UNIX commands:

Command Description

ls

lists the files and subdirectories in the current directory

pico filename.txt

a simple text file editor, hit control-X to save and exit

rm filename

removes (deletes) the file called "filename"

cd subdir

change the current directory to subdir
cd .. change directory to the parent directory

cd

without an arguments, this sends you to your home directory

mkdir dirname

make a subdirectory called dirname

rmdir dirname

remove a subdirectory called dirname

lpr filename.ps

sends a postscript file to the printer

lpd

view the print queue, and JOBNUMBERS

lprm JOBNUMBER

used to remove a print job from the queue

passwd

change your password

Using these commands, you could try the following exercise:

Task Thing to Type
Make a subdirectory called 'animals'

mkdir animals

Go into that new directory

cd animals

Create a text file called cow

pico cow

Now type something bovine and hit... control-X
List the file you have created

ls

Print the file

lpr cow

Remove the file you have created

rm cow

List the now empty directory to confirm the deletion

ls

Change to the parent directory again

cd ..

delete the animals directory

rmdir animals

The behavior of UNIX commands can be modified using 'options'. For example, if you want to list not only the 'normal' files, but also the 'hidden' files, try the following:

ls -a

Or to get a more detailed listing of your files, try:

ls -l

To learn more about the options for a given command, try typing:

man commandname

That will get you the online manual page.

If you want to close one of your extra text windows, type:

exit

If you type exit or logout in your primary login window, it will log you out of the system.