Basic Terminal Tutorial

In the examples below, items in CAPS are filler content representing an actual file or folder on your computer. Items you type into The Terminal appear in light blue.

./
The current directory.
../
The parent of the current directory.
alias
Displays all keyboard aliases (shortcuts), usually in a file called .bash_aliases.
atom
Launches Atom, assuming the shell commands have been installed. Typing atom . opens the current folder in Atom and typing atom FILE opens FILE in Atom.
cat FILE
Displays the contents of FILE, then returns control to The Terminal.
cd
Changes directory to your home folder, ~/Users/YOUR_NAME. Typing cd FOLDER changes into FOLDER and typing cd ../FOLDER changes into a directory called FOLDER in the current directory’s parent.
clear
Clears the screen of any content, placing the cursor at the top of The Terminal’s window.
cp FILE.txt COPY-OF-FILE.txt
Copies the file FILE.txt to a new file called COPY-OF-FILE.txt
head FILE.html
Shows the first 10 lines of FILE.html
history
Displays a history of all the typed commands into The Terminal.
ls
Displays the files and folders in the current directory, excluding those that start with a dot. Typing ls -a lists all files and folders that start with and without a dot. And, typing ls -d .* lists only files and folders that start with a dot.
man COMMAND
Displays the manual for COMMAND.
mkdir NEW_FOLDER
Creates a new folder called NEW_FOLDER in the current directory. Using the -p flag creates intermediate folders. For example, to create folder C inside folder B inside folder A, none of which exists, you’d run mkdir -p A/B/C.
mv FILE FOLDER/
Moves FILE inside FOLDER. mv is also used to rename a file. For example, mv FILE FILE_WITH_NEW_NAME renames FILEFILE_WITH_NEW_NAME
more FILE
Render the contents of FILE one screenful at a time. You will need to type q to exit.
open .
Opens the current folder in Mac OS X’s Finder. (This is a Mac-only command.)
rm FILE
Removes FILE. Some Linux and Mac OS systems don’t have a guard on the rm command, meaning that the user isn’t asked to verify the removal of a file. Because files removed with rm aren’t retrievable, use the -i flag so you can verify that, indeed, you want to remove a file. For example, rm -i FILE would ask if you want to remove FILE?.

To recursively remove a folder, run rm -r FOLDER; and, to forcefully and recursively remove a directory without interaction, run rm -fr FOLDER.
sudo COMMAND
Run COMMAND as the current user with privileged access.
tail FILE.html
Shows the last 10 lines of FILE.html
touch FILE
Creates a new, empty file called FILE. If FILE exists, touch does nothing.