Programming Fundamentals
File Operations |
---|
pwd - Print working dir |
ls [options] - List contents of current dir 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) |
---|
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 - Logout of current session |
!! - Repeat last command |
Up/Down - Scroll through commands |
TAB - Autocomplete |
TAB TAB - Show list of autocomplete options |