Basic Unix Commands

Files, folders, and applications work the same way in the terminal as they do on normal computer, but instead of using the mouse to click, find, and open them, commands are typed into the command line to direct the computer what to do. The following are some basic commands that are necessary to navigate the system and edit files. Remember capitalization counts!

Command Effect Usage
man Displays the manual page for any command. This will include how the command's arguments, options, and examples of it's use.
man [command]

cat

Prints the contents of one or more files onto your screen.
cat fileName1 [fileName2] ...
cd Changes the directory you are working in. With no specified directory it will send you to your home directory (~)
cd [directoryName]

To go up a level:

cd ..
cp Copies the contents of one file to another file or multiple files to another directory.
cp sourceFile targetFile
cp sourceFile1 sourceFile2 ... targetDirectory
ls Lists the contents of the current directory.
ls [options]

To view hidden files:

ls -a
mkdir Creates one or more directories in the current directory.
mkdir directoryName
mv Moves a file by one name to another. If the target does not exists then the source file is renamed to the name of the target. If the target exists and is the name of a directory then all files listed as a source file will be moved to the directory.
mv sourceFile1 sourceFile2 ... targetFile/Directory
pwd Returns the path of the current directory. This is useful to make sure you are in the correct directory or if you become lost.
pwd
rm Deletes one or more files. Use -r in options to remove directories as well.
rm [options] file1 file2 ...
rmdir Deletes any empty directories. Use this instead of rm -r to ensure files are not accidentally deleted.
rmdir directoryName
tail Displays the last few lines in a file. Useful to see recent changes appended to a file. tail fileName

If there are any further questions, or there is an issue with the documentation, please contact rc-help@rit.edu for additional assistance.