Getting Started with the Unix Operating System
NOTE: Some Unix documentation is also available on the web from the
UNF home page: http://www.unf.edu/compserv/manuals.
Here are some of the common Unix commands needed to get started:
These commands are issued from the Unix prompt. Unix is case sensitive.
Spaces are important, so don't put any spaces where none is shown.
However, the number of spaces is not significant, so if there is one
space, there could be several. Words in italics are generic
place holders to be replaced by actual identifiers.
ls -- provides a listing of all the files (including subdirectories)
in the current directory. Note: you can use wildcard characters
with this command. E.g., the following command lists all files
in the current directory with the .c extension:
ls *.c
ls -l -- provides additional information about each file including its
length in bytes, its protections, and the date it was last changed.
pwd -- provides the path name of the current directory starting from
the root directory.
cd directory -- moves you down the unix directory tree structure into
the named directory. E.g., suppose the directory you are currently
in has a subdirectory named cop3530. Then the following command
will move you into that subdirectory:
cd cop3530
cd full_pathname -- moves you into the directory whose full pathname is
given. E.g., the following command will take you to a public
directory from whereever you are:
cd /usr/public/cop3530/swallace
cd -- all by itself returns you to your home directory.
cd ../ -- moves you up one level in the directory tree.
mkdir subdirectory_name -- creates a subdirectory of the current
directory with the given name.
rmdir subdirectory_name -- removes an empty subdirectory with the
given name from the current subdirectory.
cp filename1 filename2 -- makes a copy of the file with filename1
and gives the copy the name filename2. E.g., if you are in your
home directory, the following command will make a copy of the file
named unix.commands in our public directory in your home directory:
cp /usr/public/cop3530/swallace/unix.commands .
The '.' says make the name of the copy the same as the name of the
original.
rm filename -- removes the file with the given filename from the current
directory. If there is a file with the same name in some other
directory, it is not affected. Note: you can use wildcard characters
with this command (but be VERY CAREFUL if you do). E.g., the following
command removes all files from the current directory with the .c
extension:
rm *.c
mv oldfilename newfilename -- moves (renames) a file named oldfilename
to a file named newfilename.
lpr filename -- causes a copy of the file named to be printed on the
system printer along with a header page which includes your login id.
Note: DO NOT EVER, EVER try to print executable code such as a.out
or any file created by the compiler.
gcc filename -- invokes the Gnu C compiler. It expects the file named
to have a .c extension. If the file compiles with no errors, a
file named a.out is created and stored in the current directory.
To execute that file, simply type the name of the file at the Unix
prompt. If the compiler finds errors, (sometimes cryptic) error
messages are generated and are sent to the monitor screen.
cat filename -- scrolls a copy of the named file on the monitor screen.
(If the file is long enough that it doesn't all fit on one screen,
the top scrolls off the screen.)
more filename -- copies the named file to the screen a page at a time.
less filename -- is similar to "more" but is more powerful. Allows
scrolling backward as well as forward and has other capabilities.