Computer Science Department
Basic UNIX Commands
- apropos <keyword> Locate a command based on a keyword.
Examples:
apropos printer Display a list of all UNIX commands whose description contains the word "printer" along with a description of what each command does. apropos 'change directories' Display a list of all UNIX commands whose description contains the phrase "change directories".
- cd <pathname> Change directory. If no pathname is given, change to your home directory.
Examples:
cd lab1 Change to subdirectory called lab1. cd Change to top of your home directory. cd .. Change to the parent of the current directory. cd ~/lab1/garbage Change to the directory called lab1/garbage in your home directory.
- chkquota Display printer quota and monthly usage so far.
- clear Clear the xterm window.
- cp <src_pathname> <dest_pathname> Copy one or more files.
Examples:
cp file1.cc file2.cc Make a copy of the file file1.cc and call the copy file2.cc. cp proj.cc ~/projects/project1 Make a copy of the file proj.cc and put the copy in the projects/project1 directory of your home directory. cp -r /cs141/lab2 ~/labs Copy the directory /cs141/lab2 and all of its contents, treating directories as if they were regular files, into the directory ~/labs.
- lpq Display the contents of the printer queue with job numbers.
- lpr <pathname> Send a job to the printer.
- lprm <job #> Remove a job from the printer queue.
- ls <optional pathname> List the contents of directories.
Examples:
ls List the contents of the current directory. ls lab1 List the contents of the lab1 directory. ls program.cc Is the file program.cc in the current directory? ls *.cc List all of the files in the current directory ending with .cc.
- man <command> Display reference manual pages.
Example:
man ls Display information about the ls command including a description and list of options.
- mkdir <pathname> Make a new directory.
Example:
mkdir lab2 Make a subdirectory called lab2 in the current working directory.
- more <pathname> Browse or page through a text file.
- mv <src_pathname> <dest_pathname> Move or rename files.
Examples:
mv file1.cc file2.cc Rename the file file1.cc as file2.cc. mv *.cc proj1 Move all of the files ending in .cc into the proj1 directory.
- pwd Display the pathname of the current working directory.
- quota -v Display the disk quota and usage.
- rm <pathname> Remove files.
Example:
rm file1.cc Remove the file file1.cc from the current directory.
- rmdir <pathname> Remove directories. (Before a directory can be removed, it must be empty.)
Example:
rmdir projects Remove the subdirectory called projects from the current directory.
Copyright ©2008 · Arts & Sciences at The College of William and Mary
