Command Line / Shell Flashcards
Terminal (or Terminal Emulator)
A program that accepts text based commands and can render text on the screen
Shells
Interpret the commands you type and execute them. Often referred to as “REPL”s:
Read - Read the commands you type
Evaluate - Evaluate those commands, usually by running other programs on your computer
Print - Print the output of those commands
Loop - Give you a new prompt to type another command and repeat
Command to print something
echo
Prefix when you want to use a variable in a terminal command
$
Command to see the commands you’ve typed in the past
history
Keys to use to quickly cycle through your command history
Up and Down arrows
Command to clear terminal screen
clear
OR
ctrl + l
Command to see the filepath of your current working directory
pwd
Command to see the contents of your current working directory or a downstream directory
ls
ls filepath
Command to see the contents of your current working directory (including hidden files)
ls -a
Command to move into (or down) a directory/filepath
cd filepath
Command to move back (or up) directories
cd .. (one directory)
cd ../.. (two directories and so on)
Command to move to home directory
cd ~
Absolute vs Relative Path
Absolute - Filepath that starts at the root of the filesystem
Relative - Filepath that takes into account your current directory
Command to view the contents of a file or files combined
cat filename (single file)
cat filename1 filename2 (multiple files)