Essential UNIX/LINUX

Directory Commands

ls [directory]
Lists all the files in the specified directory. If no directory is specified, it defaults to the current directory.

cd [directory]
Changes the current directory to the specified directory. If no directory is specified, it brings you to your home directory.

mkdir [directory]
Creates a new directory.

rmdir [directory]
Removes the specified (empty) directory. To remove a non-empty directory, use rm -r [directory] at your own risk.

pwd
Tells you the name of the current directory.

File Commands

rm [filename(s)]
Deletes the specified file(s). Once a file is deleted, it is gone forever. Be especially careful when using wildcards with this command.

cp [filename(s)] [directory]
Copies the specified file(s) to the specified directory. Keeps the originals intact.

cp [filename] [newname]
Creates a copy of the specified file with a new name.

mv [filenames(s)] [directory]
Moves the specified file(s) to the specified directory. The originals are destroyed.

mv [filename] [newname]
Renames the specified file to the given new name. You can also "rename" a file into another directory by specifying a name in that directory.

Filenames and Directories

~
The tilde is always the name of your home directory, so typing "cd ~" will bring you to your home directory.

/
The forward slash is used as the top directory for the system and also to separate the names of subdirectories. For instance, "cd /user/mallen" says to start from the top of the directory tree ("/"), go into the subdirectory "user" and then into the subdirectory "mallen".

*
The asterisk is used as a wildcard when naming files. For instance, *.scm will match all the filenames that end with ".scm".