Terminal and shell basics flashcards
Move around, find anything, fix servers and automate the boring parts from the command line.
Beginner friendly, starts from zero
0
Terminal and shell basics at a glance
The terminal lets you control a computer by typing short commands instead of clicking.
Like a phone line to a helpful operator: you say exactly what you want, and the shell makes it happen.
Words you will meet
- Terminal
- The text window where you type
- Shell
- The program that reads your typed line and runs it
- Command
- One typed instruction, like ls
- Path
- The address of a file or folder, folder by folder
- Flag
- An option that changes how a command works, like -l
- Argument
- The thing a command works on, like a file name
- SSH
- A safe way to log in to another computer and type there
- Root
- The all-powerful admin user; sudo borrows its power
The steps
- 1. Start from zero (12 cards): What the terminal is, the key words in plain English, and your first commands.
- 2. Core basics (15 cards): Where you are, files and folders, reading files, help, history and the keys that save hours.
- 3. Next steps (17 cards): Pipes and redirects, search, permissions, processes, environment, jobs, disk and line editing.
- 4. Go deeper (17 cards): Safe scripts, quoting, text processing, JSON, SSH, sync, sessions, scheduling, ports and bulk work.
All 12 cards in Start from zero
- What is the terminal, in one plain sentence?
- A window where you control the computer by typing short text lines instead of clicking icons.
- Why type commands when you can click?
- Typing is faster for repeat jobs, works on far-away computers that have no screen, and can be saved as a list to run again any time.
- Where do you already meet the terminal idea?
- Typing in a search box and pressing Enter, or asking a voice assistant to 'set a timer for 5 minutes'. You say exactly what you want and it acts.
- What is an everyday picture for the terminal and the shell?
- The terminal is the phone line; the shell is the helpful operator on the other end who listens to your request and makes it happen.
- What do command and prompt mean?
- A command is one typed instruction, like
lsto list files. The prompt is the short text, often ending in$, that shows the computer is ready for your next command. - What do file, folder and path mean?
- A file holds content, like a photo. A folder (also called a directory) holds files. A path is the address of a file, like
/home/ravi/photos/trip.jpg, folder by folder. - What are flags and arguments?
- An argument is what the command works on, like a file name. A flag is an option that changes how it works, usually starting with
-, like-lfor a long list. - What are a server, SSH and a script?
- A server is a computer that runs apps for others, usually far away. SSH lets you log in to it and type commands there. A script is a file of commands that run one after another.
- What are root and sudo?
- Root is the all-powerful admin user that can change anything.
sudolets you run one command as root, so you borrow that power only when you need it. - What do you need before starting?
- Nothing to install. Mac and Linux have a Terminal app built in; on Windows, open the Terminal app and pick Ubuntu (WSL) or PowerShell.
- What is a first tiny win in the terminal?
pwdprints where you are,lslists what is in that folder, andechoprints back the words you give it.- What will you be able to do after this topic?
- Move around folders, find and move files, read logs, chain commands together, fix a server over SSH and write small scripts that do boring jobs for you.
Terminal and shell basics cheatsheet
Move and look
pwdCurrent folderls -lahtrAll files, sizes, newest lastcd -Back to previous foldertree -L 2 -I node_modulesFolder tree, two levelsless +F app.logFollow a log,Ctrl+Cto scrolltail -n 200 -f app.logLast 200 lines, then live
Files
mkdir -p a/b/cMake the whole pathcp -a src/ dst/Copy keeping owners and timesmv -n old newRename, never overwriterm -rf "${DIR:?}/"Delete, refuse ifDIRis emptychmod 600 .envOwner read and write onlytar -czf out.tgz dir/ && tar -xzf out.tgzPack and unpack
Search and text
grep -rnw --exclude-dir=node_modules term .Find a word in codefind . -type f -size +100M -mtime -7Big recent filessort | uniq -c | sort -rn | headTop repeated linesawk '{print $1}' fileFirst columnsed -i.bak 's#old#new#g' fileReplace in place, with backupjq -r '.[] | .id' data.jsonPull fields from JSONfind . -print0 | xargs -0 -P 8 cmdParallel, safe with any names
Line editing keys
Ctrl + RSearch command historyCtrl + AStart of lineCtrl + EEnd of lineCtrl + WDelete word backCtrl + UDelete to start of lineCtrl + CCancel running commandCtrl + ZPause, thenfgorbgCtrl + LClear screen
System and network
ps aux --sort=-%mem | headTop memory userskill PID; kill -9 PIDPolite stop, then forcedf -h; du -xh --max-depth=1 | sort -hDisk free and who used itjournalctl -u nginx -fFollow a service's logslsof -nP -iTCP:3000 -sTCP:LISTENWho holds a portrsync -avz --partial src/ host:/dst/Resumable sync to a servertmux new -s work / tmux attach -t workSession that survives logout