CPSC 120 B




Lecture
MWF 10:50am - 11:50am
Lab
MWF 12:00pm - 1:00pm

Scotty Smith

Office
Trexler 365-B
Office Hours
Monday / Thursday
3:00pm - 5:00pm
Email
chssmithATroanoke.edu

UNIX Commands

Note: all paths can be absolute or relative . Commands will be added to this page as necessary as the course progresses.
CommandPurposeUsage
pwd Find ones current location in the directory tree (Present Working Directory) pwd
ls View the contents of the current directory ls
ls -l : view a detailed listing of files
ls -a : view all files, even hidden files
ls -al : view a detailed listing of all files
cd Change directories cd <path>
cd or cd ~ : change to your home directory
mkdir Create directory mkdir <path to directory>
mv Move a file. Can be used to rename a file/directory. mv <file> <path to new file>
mv <file> <new name>
cp Copy a file cp <file> <path to new location>
rm Remove a file.
BE CAREFUL! There is no recycle bin in Unix. This cannot be undone. Make sure you want to do this BEFORE you do it.
rm <file>
rmdir Delete a directory (The directory must be empty) rmdir <path to directory>
emacs Open up the Emacs Text Editor. Go to the Emacs Reference for more information.
zip Creates or adds files to a zip archive of specified files. Creates a file <archive name>.zip if it does not exist. zip <archive name>.zip <files to add>

ex: zip assign1.zip *
[copies all the files in the current directory (using the * symbol) into an archive called assign1.zip].
unzip Copies files out of a zip archive file. unzip <compressed file>

ex: unzip assign1.zip
[Copies all of the files in assign1.zip into the present working directory]
tar Compress/uncompress files. Creates a file if "compressed filename" does not exist. Compress file:
tar -cvf <compressed filename> <directory to encrypt>
Decompress file:
tar -xvf <compressed file>
less Displays a file at the terminal.
Press space to scroll down
Press b to scroll up
Press q to quit
less <filename>
man Used to learn parameters and usage information for a Unix command man <Unix Command>