Programming Fundamentals
File Operations |
---|
pwd - Print working directory |
ls [options] - List contents of current directory ls options: -a - All options including hidden -l - Long version -s - Sort by size -t - Sort by time -r - Reverse order |
cd dir - Move to directory dir dir shortcuts: . - Current directory .. - Previous directory ~ - Home directory / - Root directory |
mkdir dir - Make directory called dir |
mv source1 [source2..] dir - Move source(s) to dir |
mv source1 source2 - Rename source1 to source2 |
cp [options] source1 source2 - Copy source1 to source2 cp options: -R - Recursive (Copy contents of subdirectories etc.) |
rm source - Remove source rm options: -d - Remove empty directories -R - Delete contents recursively -f - Ignore nonexistent files and never prompt before removing |
cat file - Show file contents |
head file - Show first 10 lines of file |
tail file - Show last 10 lines of file |
Bash Commands | man cmd - Show help manual for cmd (command) |
---|
clear - Remove program output from the terminal |
date - Show date |
whoami - Show your username |
uptime - Show uptime |
history - List recent commands |
Bash Shortcuts |
---|
CTRL +... a - Jump to start of line e - Jump to end of line k - Delete to end of line u - Delete to start of line y - Recall last deleted w - Delete word r - Search previous commands c - Halt current command z - Stop current command d - Signify End Of File (EOF) to the current program |
!! - Repeat last command |
Up/Down - Scroll through commands |
TAB - Autocomplete |
TAB TAB - Show list of autocomplete options |
VS Code Shortcuts | Note: In this section selected refers to the line your cursor is on, or the block of code you have highlighted. |
---|
CTRL + / - Comment or uncomment selected code |
TAB - Indent selected code by one level |
SHIFT + TAB - Unindent selected code by one level |
Ctrl + D - Selects the word at the cursor, or the next occurrence of the current selection. |
CTRL + c - Copy selected code |
CTRL + x - Cut selected code |
CTRL + v - Paste selected code |
ALT + Up/Down - Move selected code up or down in the file |
CTRL + b - Open/close the file explorer sidebar |
CTRL + SHIFT + L - Select all words in the file that match the currently highlighted one |
CTRL + TAB - Switch between open tabs |
CTRL + w - Close the focused tab |