Swarthmore College Department of Computer Science

basic unix commands

There are many commands that one can use on the unix command line. A few of these are very important, and you will find yourself using them frequently during your CS experience.

Command Examples Description
ls ls
ls -alF
list files and directories
cp cp file file.bac
cp file dir/.
copies a file (use -r for directories)
mv mv file newf moves or renames file
rm rm file deletes a file (use -r for dirs)
less less filename view file, hit q to quit
cd cd dir change directory (may need full path)
mkdir mkdir newdir make new directory
pwd pwd print working dir (where you are)

Other things to note: if you want to run a program, you can usually just type the program name, like python, firefox, or gvim. If you type man any_command_name you should find a detailed list of instructions for using that command, as well as any options the command might have.