UNIX Basics

I. Logging on UNIX from UND


III. UNIX Commands

ls lists directory contents

ls -l long listing

ls -a list all, including those files that start with a dot (.).

pwd print working directory

mkdir create a subdirectory

mkdir [directory name] e.g. mkdir sas

cd change working directory

cd [directory name] e.g. cd sas

cd .. moves up 1 directory level

cd - toggles between home & directory just in

pico simple editor

pico [filename] e.g. pico prog1.sas

cp copy a file

cp [filename1] [filename2] e.g. cp survey.output survey.output.old

You now have 2 files that have the same contents

mv move (rename) a file

mv [filename1] [filename2] e.g. mv survey.output survey.output.old

You now have survey.output.old, survey.output has been renamed

more or less view a file one page at a time (Note: view only no editing)

more [filename] or less [filename]

Once the file is displayed, press f to move forward, b to move backward, enter moves down a line at a time, up arrow moves up a line at a time, and q to quit.

rm remove (erase) a file

rm [filename] e.g. rm prog1.sas

rmdir remove a directory

rmdir [directory name] note: the directory has to be empty

cat view the contents of a file

> redirect output (allows you to save the results of a command to a file, if the file already exists it will be replaced)

cat [file1] [file2] > [file3] e.g. cat sasinput sasdata > survey.sas

>> adds to an existing file

cat [file1] [file2] >> [file3]

Print to your default printer

pcprint [filename] e.g. pcprint prog1.sas

^p recalls the last command

| Pipe, allows you to pass the results of a command to another command

e.g. your file listing is longer than one screen & it scrolls too fast to read

you can pipe the listing into the more command and view one page at a time

ls | more

passwd change your password

exit logoff

Revised: 1/20/2006