Command reference
What a command does, what it is made of and where it can bite. With examples from the tracks and one-click practice.
Bash
- pwd — Show which folder you are in
- ls — List files and folders
- cd — Go to another folder
- mkdir — Create a folder
- touch — Create an empty file or update its modification date
- cp — Copy a file or a folder
- mv — Move or rename a file
- rm — Delete files and folders
- cat — Print a file to the terminal
- head — Show the first lines of a file
- tail — Show the last lines of a file, or follow it
- less — Read a big file page by page
- wc — Count lines, words and bytes
- grep — Find the lines with some text in files
- find — Find files and folders by name, type and more
- which — Find out where a program lives
- > >> 2> — Output redirection. Write a command's output to a file instead of the screen
- | — The pipe. Pass the output of one command to the input of another
- sort — Sort lines and drop duplicates
- echo — Print text or the value of a variable
- export — Set an environment variable for the programs you run
- env — List environment variables
- source — Run the commands from a file in the current shell
Git
- git config — Set up git: the author name and email, the editor and other settings
- git init — Create a new repository in the current folder
- git clone — Download a repository from a server with its whole history
- git status — See what changed in the folder and what is already staged
- git add — Stage changes so they go into the next commit
- git commit — Save the staged changes to history as a new commit
- git diff — See exactly what changed in your files, line by line
- git branch — List, create, rename or delete branches
- git switch — Switch to another branch, or create a new one and switch to it
- git merge — Bring the changes from another branch into the current one
- git log — Show the commit history
- git show — Show one commit: its message, author and every change in it
- git blame — Find out who last changed each line of a file, and in which commit
- git restore — Discard edits in a file or unstage it
- git reset — Move the branch to another commit, for example to undo the last commits
- git revert — Undo a commit with a new commit, without rewriting history
- git remote — List and add remote repositories
- git fetch — Download new commits from the server without touching your branches
- git pull — Download changes from the server and merge them into the current branch
- git push — Send your commits to the server
- git stash — Put uncommitted edits aside for a while and bring them back later
- git rebase — Move a branch's commits onto a new base, or rewrite the last commits
Linux
- whoami — Find out which user you are working as
- sudo — Run a command with admin rights
- adduser — Create a new user
- usermod — Change a user, for example add them to a group
- passwd — Change a user's password
- chmod — Change who may read, write or run a file
- chown — Change the owner and group of a file or folder
- ps — List processes
- top — Watch the system load and processes live
- kill — End a process by its ID
- pkill — End processes by name
- systemctl — Manage services: start, stop, start at boot
- journalctl — Read the logs of services and the system
- ip — See network interfaces and addresses
- ss — Find out which ports are open and who listens on them
- curl — Send an HTTP request from the terminal
- ping — Check whether a host is reachable
- ssh — Connect to a remote server
- scp — Copy files between computers over SSH
- df — See how much disk space there is
- du — Find out how much space a folder takes
- free — See how much memory is used and free
- tar — Pack files into an archive or unpack one
- apt — Install, update and remove software
GitHub CLI
- gh auth — Sign in to GitHub from the terminal and check who you are signed in as
- gh repo clone — Clone a GitHub repository by its short name
- gh repo create — Create a repository on GitHub
- gh repo fork — Fork someone else's repository
- gh browse — Open a repository, an issue or a file on GitHub in the browser
- gh pr create — Open a pull request from the current branch
- gh pr list — List pull requests
- gh pr view — Read a pull request: description, status and reviews
- gh pr checkout — Fetch a pull request's branch and switch to it
- gh pr diff — See the changes of a pull request
- gh pr status — A summary: the current branch's PR, your PRs and review requests
- gh pr checks — Check the CI status of a pull request
- gh pr review — Approve a pull request or ask for changes
- gh pr comment — Comment on a pull request
- gh pr ready — Mark a draft pull request as ready for review
- gh pr merge — Merge a pull request
- gh issue list — List issues
- gh issue create — Open a new issue
- gh issue view — Read an issue
- gh issue comment — Comment on an issue
- gh issue close — Close an issue
- gh issue develop — Create a branch to work on an issue
- gh release — Publish a release and list releases
- gh run — Follow GitHub Actions runs and read their logs
- gh workflow run — Start a GitHub Actions workflow by hand
- gh secret set — Add a secret for GitHub Actions