Cheatsheet¶
Here is a summary of the most useful commands and shortcuts to know when you use the terminal.
Common commands¶
Some of the most useful commands to know:
# List files and directories
ls
# Change directory
cd <directory>
# Print the working directory
pwd
# Create a directory
mkdir <directory>
# Create an empty file
touch <file>
# Remove a file
rm <file>
# Remove a directory
rm -r <directory>
# Copy a file
cp <source> <destination>
# Copy a directory
cp -r <source> <destination>
# Move a file
mv <source> <destination>
# Print the content of a file
cat <file>
# Print the content of a file with pagination
less <file>
Common terminal shortcuts¶
Some of the most useful shortcuts to know:
History¶
Ctrl+R - Search command history interactively.
Ctrl+P - Previous command in history.
Ctrl+N - Next command in history.
Cursor Movement¶
Ctrl+A - Move to the beginning of the line.
Ctrl+E - Move to the end of the line.
Alt+B - Move backward one word.
Alt+F - Move forward one word.
Editing¶
Ctrl+K - Delete (kill) from the cursor to the end of the line.
Ctrl+U - Delete from the cursor to the beginning of the line.
Ctrl+W - Delete the word before the cursor.
Alt+D - Delete the word after the cursor.
Ctrl+Y - Paste (yank) the last deleted text.
Various¶
Ctrl+L - Clear the screen (similar to clear command).
Ctrl+C - Interrupt/kill the current process.