Comp 121 - Summary of Unix Commands
Use the text editor "pico". More information on any Unix command
can be obtained in Unix by typing
man cmd
for example "man pico" gives detailed documentation on the
pico editor. One of the first things you should do is to change
your Unix password using the Unix command "passwd".
mkdir - used to create directories (folders)
usage:
mkdir
example:
mkdir comp121
pwd - used to find out the name of your current folder
usage:
pwd
note: this command returns a 'fully qualified' directory name. The name
that
appears after the last / character is the name of your current
directory. The one to the left of that is the name of the
directory that contains your current directory. This is a good
example of a tree data structure, something you will be learning
this semester.
cd - used to change directories (folders)
usage:
cd
note: the special dirname ".." means the directory which contains the one
you
are currently in.
example:
mkdir comp121
ls - display the contents of the current directory
usage:
ls
note: options are optional. A good one to use is -l, which stands for
/long format/
example:
ls -l
more - display the contents of a file
usage:
more
note: if the file is longer than a screenfull, more will pause between
screens.
you can press the space bar to move to the next screen.
example:
more foo
cp - copy a file
usage:
cp
note: cp will not destroy the original file
example: -- will create a new file called bar that is a copy of the file
foo
cp foo bar
mv - rename (move) a file
usage:
mv
note: mv is like cp, but the original will be destroyed
example: -- will rename file foo to now be called bar, foo will go away
mv foo bar
rm - remove a file (make it go away)
usage:
rm
note: this command is irreversible. Once you rm a file, you can't
undelete it.
example:
rm foo
man - display the manual page for a command
usage:
man
note: man uses the more program to display the help
example: -- will show the manual page for the man command
man man
g++ - the C++ complier we will be using on the Unix machines
usage:
g++
note: you can put multiple filenames, if needed
example:
g++ project1.cc
a.out - name of the "executable" program created by g++
usage:
a.out
note: If you don't want a.out to be lost when you re-compile, then "cp"
it to another name before compiling again with g++
example:
a.out