Bash — Common Commands

Quick reference for the file/directory commands I use most often.

File and directory management

CommandWhat it does
lsLists the contents of a directory.
cd [directory]Changes the current directory.
pwdPrints the current working directory.
mkdir [directory_name]Creates a new directory.
rmdir [directory_name]Removes an empty directory.
touch [file_name]Creates a new empty file.
cp [source] [destination]Copies files or directories.
mv [source] [destination]Moves or renames files or directories.
rm [file_name]Deletes a file.
rm -r [directory_name]Deletes a directory and its contents recursively.