Cheat sheet · Foundations
Linux, terminal and Git cheat sheet (Linux)
FreeA quick-revision companion to the Linux, terminal and Git roadmap in its Linux edition: your distribution and package manager, the shell, text tools, permissions and processes, Git, GitHub, scripting and servers.
Chapters
8 chapters · 76 concepts
1Your machineGetting a Unix shell, a package manager, Git and an editor working, and the words for the parts you are using.6 concepts
- 1Linux distributionA packaged Linux system: the kernel plus a package manager, default tools and a release schedule, such as Ubuntu, Debian, Fedora or Arch.
- 2Terminal, shell and promptThe terminal is the window.
- 3System package managerThe tool that installs, updates and removes software from trusted repositories: apt on Ubuntu and Debian, dnf on Fedora, pacman on Arch and Homebrew on macOS.
- 4man, --help and tldr
man cmdopens the full manual (search with/, quit withq),cmd --helpprints a summary, andtldr cmdshows short practical examples. - 5Git configurationSettings stored in
~/.gitconfigfor all repositories, or.git/configfor one. - 6VS Code and the code commandVisual Studio Code is a free editor.
6 in this chapterOpen this chapter2Shell basicsMoving around, working with files, and how the shell expands patterns, connects commands and finds programs.11 concepts
- 1Absolute and relative pathsAn absolute path starts at the root
/; a relative path starts from the current folder. - 2File commands
mkdir -pcreates folders (and parents),touchcreates an empty file,cp -rcopies,mvmoves or renames,rmdeletes andrm -rdeletes folders. - 3Globbing and brace expansionThe shell expands
*(any characters),?(one character) and[abc](one of a set) into matching file names before the command runs. - 4QuotingSingle quotes keep text exactly as written.
- 5PipesA pipe
|sends the standard output of one command into the standard input of the next. - 6Redirection and the three streamsPrograms read standard input and write standard output and standard error.
- 7Environment variablesNamed values inherited by every program the shell starts, such as
HOME,USER,EDITORandPATH. - 8PATHA colon-separated list of folders the shell searches, in order, for commands.
- 9Shell startup files and aliasesFiles the shell runs when it starts:
~/.bashrcfor interactive Bash,~/.zshrcfor zsh, and login files such as~/.profileor~/.zprofile. - 10nano and VimTerminal editors. nano shows its shortcuts: Ctrl+O saves, Ctrl+X exits.
- 11Opening files and the clipboardCommands that hand a file to your desktop or move text to and from the clipboard.
11 in this chapterOpen this chapter- 1Absolute and relative pathsAn absolute path starts at the root
3Text toolsViewing, searching, filtering and transforming text, from logs and CSV files to JSON from an API.8 concepts
- 1cat, less, head and tail
catprints a file,lesslets you scroll and search it,headandtailshow the start and end, andtail -ffollows a growing file. - 2grepPrints lines that match a pattern, in files or in piped input.
- 3findWalks a folder tree and matches files by name, type, size or modification time, optionally running an action on each.
- 4sort, uniq, cut, tr and wcSmall tools that reorder, count, slice and clean lines of text.
- 5Regular expressionsA pattern language:
.any character,*zero or more,+one or more,?optional,^and$start and end of line,[0-9]a set,( )a group. - 6sedEdits text as it streams through, most often with substitution
s/old/new/g. - 7awkProcesses text line by line, splitting each line into fields
$1,$2and so on, with-Fto choose the separator. - 8jqA command-line tool for reading, filtering and reshaping JSON.
8 in this chapterOpen this chapter- 1cat, less, head and tail
4Permissions, processes and packagesWho can read, write and run what, what is running and how to stop it, and how to install tools and language versions cleanly.10 concepts
- 1Permission bitsEach file has read, write and execute permissions for its owner, its group and everyone else, shown by
ls -las, for example,rwxr-xr--. - 2chmodChanges permissions, either symbolically (
u+x,go-w) or numerically, where read is 4, write 2 and execute 1 for each of owner, group and others. - 3Ownership and chownEvery file belongs to a user and a group.
- 4root, sudo, users and groupsroot can do anything.
- 5ProcessesA running program, with a process ID, an owner and a parent.
- 6Signals and killMessages sent to a process.
- 7Jobs: foreground and background
cmd &starts a job in the background, Ctrl+Z pauses the foreground job,bgresumes it in the background,fgbrings it back andjobslists them. - 8Installing developer toolsSystem tools come from the system package manager; project libraries come from language managers such as pip and npm, installed per project.
- 9Version managersTools that install several versions of a language in your home folder and switch between them by changing PATH, such as nvm for Node and pyenv for Python.
- 10Disk and system checks
df -hshows free space per file system,du -shshows how big folders are,free -hshows memory on Linux anduname -ashows the kernel.
10 in this chapterOpen this chapter- 1Permission bitsEach file has read, write and execute permissions for its owner, its group and everyone else, shown by
5Git fundamentalsHow Git stores work, the daily commands, branching and merging, conflicts, and undoing mistakes safely.12 concepts
- 1Commits and snapshotsA commit is a snapshot of the whole project plus a message, author and a pointer to its parent commit, identified by a hash.
- 2Working tree, staging area and repositoryChanges move from the working tree (your files) to the staging area with
git add, then into history withgit commit. - 3git log and git diff
git logshows history,git diffshows changes,git showshows one commit andgit blameshows who last changed each line. - 4Commit messagesA short imperative summary of about 50 characters, a blank line, then a body explaining why when needed.
- 5.gitignoreA file listing patterns Git should not track, such as dependencies, build output, logs and secrets.
- 6BranchesA branch is a movable name pointing at a commit.
- 7git stashSaves uncommitted changes on a stack and cleans the working tree, so you can switch tasks and restore them later.
- 8MergeCombines another branch into the current one, with a merge commit when histories diverged or a fast-forward when they did not.
- 9RebaseReplays your commits on top of another branch, creating new commits with new hashes.
- 10Merge conflictsWhen two branches change the same lines, Git stops and marks the file with
<<<<<<<,=======and>>>>>>>sections for you to resolve. - 11Undoing changes
restorediscards or unstages changes,commit --amendfixes the last local commit,revertadds a commit that undoes another, andresetmoves a branch… - 12git reflogA local log of every position HEAD has been at, including commits no branch points to any more.
12 in this chapterOpen this chapter6GitHub and collaborationRemotes, SSH keys, the pull request workflow, reviews, forks and the GitHub CLI.9 concepts
- 1RemotesNamed links to other copies of the repository.
- 2fetch, pull and push
fetchdownloads new commits without changing your files,pullfetches and then merges or rebases, andpushuploads your commits. - 3SSH keysA key pair: a private key that stays on your machine and a public key (
.pub) you give to GitHub or a server. - 4GitHub flowA lightweight workflow: main is always deployable; each change gets a branch, commits, a pull request, review and checks, then a merge and branch deletion.
- 5Pull requestA request to merge a branch, with a description, discussion, review and automated checks.
- 6Code reviewReading a teammate's change to check correctness, tests, clarity and fit, and leaving comments, suggestions or approval.
- 7Forks and syncingA fork is your own copy of someone else's repository on GitHub.
- 8GitHub CLIThe official command-line tool for GitHub: repositories, pull requests, issues, releases and Actions runs from the terminal.
- 9Secrets in GitPasswords, tokens and keys committed to a repository stay in its history even after you delete the file.
9 in this chapterOpen this chapter7Shell scripting and automationSmall, safe Bash scripts, checked by ShellCheck, run on a schedule with cron, and your own dotfiles.10 concepts
- 1Shebang and executable scriptsThe first line
#!/usr/bin/env bashchooses the interpreter. - 2Exit codesEvery command returns a number: 0 means success, anything else failure.
- 3set -euo pipefail
-estops on a failing command,-utreats unset variables as errors, andpipefailmakes a pipeline fail if any part fails. - 4Variables and arguments
$1,$2are positional arguments,"$@"is all of them,$#is the count,${var:-default}gives a fallback and$(cmd)captures output. - 5Conditionals and tests
if [[ ... ]]; then ... firuns code based on a test:-ffile exists,-dfolder exists,-zempty string,==string match,-gtnumber comparison. - 6Loops
forloops over a list or glob;while read -r linereads input line by line. - 7Functions and script structureNamed blocks of commands, called like programs, with
localvariables. - 8ShellCheckA static analyser for shell scripts that warns about quoting bugs, ignored errors, wrong test syntax and more, each with a numbered explanation page.
- 9cronRuns commands on a schedule defined by five fields: minute, hour, day of month, month, day of week.
- 10Dotfiles repositoryYour configuration files kept in a Git repository, with an install script that links them into your home with
ln -s.
10 in this chapterOpen this chapter- 1Shebang and executable scriptsThe first line
8SSH, servers and debuggingReaching and securing a Linux server, keeping work alive, reading logs, and checking networks step by step.10 concepts
- 1SSH login
ssh user@hostopens a secure shell on another machine. - 2SSH config fileA file of named Host blocks with the address, user, port and key for each machine.
- 3scp and rsync
scpcopies files over SSH;rsyncsynchronises folders, sending only changes. - 4First steps on a new serverUpdate packages, create a sudo user with key login, disable root and password login in
/etc/ssh/sshd_config, and enable a firewall allowing only what you… - 5tmuxKeeps terminal sessions running on a machine after you disconnect, with windows and split panes.
- 6systemctl and journalctlsystemd starts and supervises services.
- 7curlSends HTTP and other requests from the terminal and prints the response.
- 8DNS and reachability checks
digornslookupshow what a name resolves to;pingchecks whether a host answers;tracerouteshows the path. - 9Ports and listening processesA service listens on a port;
ss -tlnp(Linux) orlsof -i :PORTshows which process owns it. - 10Environment debugging checklistA fixed order of checks: read the full error, ask what changed, then check which binary runs, PATH, permissions, environment variables, disk, processes, ports…
10 in this chapterOpen this chapter- 1SSH login
- 9Glossary, A to ZEvery concept in the sheet and the smaller terms it uses, in one list.168 terms
About this sheet
Shell, Git, SSH and your dev setup.
Related on Sefism
Picked from the other libraries by shared topics.
Roadmaps
See allBest practices
See all- Git Best Practices for DevelopersGit best practices for everyday work: clear commits, clean branches and pull requests, rebase vs merge, safe force pushes, secrets, signing and recovering mistakes.
- Code Review Best PracticesCode review best practices for reviewers and authors: the approval standard, what to look for, review speed, writing kind and useful comments, handling disagreement and small changes.
- Technical Writing Best Practices for EngineersTechnical writing best practices for developers: write for your audience, clear sentences, scannable structure, design docs, READMEs and docs, PR descriptions, async updates and blog posts.
Checklists
See allProject structures
See all- VS Code extension project structureA TypeScript extension for Visual Studio Code, built from the official Yeoman generator with esbuild bundling. The example, TODO Lens, finds TODO comments and shows them in a tree view, with commands, settings and editor decorations. The tree grows from the generator's Hello World into commands, providers and editor-free core logic, then tests on three operating systems, publishing to the Marketplace and Open VSX, and a webview with a strict security policy. For students who use VS Code every day and want to build a tool other developers install.
- Turborepo monorepo project structureOne Git repository holding several apps and the packages they share, wired together by pnpm workspaces and run by Turborepo.
apps/holds things you deploy (two Next.js apps from the starter, later an API),packages/holds shared code and config (UI components, ESLint and TypeScript configs, validation schemas, the database client). Turborepo runs each task in dependency order and caches the results, so you never rebuild what did not change. - Chrome extension project structureA Manifest V3 Chrome extension that saves highlights from any page into a side panel, built with WXT, React and TypeScript. WXT reads your
entrypointsfolder and writes the manifest for you, so the layout is one folder per thing Chrome loads (service worker, content script, popup, side panel, options) with shared code inutils. For students who have loaded an unpacked extension once and want to ship a real one to the Chrome Web Store.
Career questions
See all- How do I learn Git and GitHub properly instead of just copying commands?Learn the model first: commits are snapshots, branches are pointers, and remotes are copies. Then use Git daily on your own projects, practise a team workflow with branches and pull requests, and break things on purpose, such as merge conflicts, so you learn to recover calmly.
- Which AI tools do employers expect junior developers to know in 2026?Employers rarely require a specific brand. They expect you to use an AI coding assistant well (in the editor and in the terminal), to review and test what it produces, to call an LLM API in a small feature, and to explain when you would not use AI. Pick one assistant, learn it properly, and show judgement in your projects.
- How do I build a developer portfolio as a beginner with nothing to show?Start with two or three small but complete projects that solve a real problem, each with a clear README, screenshots and a live link or easy run steps. Put them on a simple one-page site or a tidy GitHub profile. Depth and finish matter far more than the number of projects or a fancy design.
Cheat sheets
See all- Git cheat sheetHow Git stores your work, the everyday commands, branching, undoing mistakes, remotes, reviews and team workflows.
- Linux command line cheat sheetThe Linux shell from first commands to safe Bash scripts: files, text tools, permissions, processes, services, SSH and more.
- Coding with AI tools cheat sheetClaude Code, Cursor, Copilot, used well.
Work with me
Stuck on something specific?
Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.
- 1:1 Mentorship
- Fresh Graduate Mentorship
- Career Guidance
Brand deals, promos and partnerships: tauseeffayyaz@gmail.com