Terminal Cheat Sheet
Navigation
ls
: List files and directories
ls -a
: List all files and directories
ls -l
: List files and directories in long format
ls -la
: List all files and directories in long format
cd <dir>
: Change directory
cd ..
: Go up one directory
cd ~
: Go to home directory
cd -
: Go to previous directory
File Management
mkdir <dir>
: Create a new directory
touch <file>
: Create a new file and modify last modified time
cp <from> <to>
: Copy a file or directory
mv <from> <to>
: Move a file or directory
rm <file|dir>
: Remove a file or directory
rm -r <dir>
: Remove a directory and its contents
rm -f <file|dir>
: Force remove a file or directory
rm -rf <dir>
: Force remove a directory and its contents
File Viewing
cat
: Print the contents of a file
less
: View the contents of a file