MANUAL
The terminal commands you actually need
The terminal commands you really need
This guide builds on The Terminal and PowerShell. Your AI assistant carries out many commands for you. If you know what they do, you’ll also be able to tell when something isn’t quite right.
01
Navigate
| Linux / macOS | PowerShell | What it does |
|---|---|---|
pwd | pwd | Which directory am I in? |
ls -la | ls / Get-ChildItem -Force | Show files, including hidden ones |
cd map | cd map | Go to a folder |
cd .. | cd .. | Move up one folder |
cd ~ | cd ~ | To your home directory |
02
Files and folders
| Linux / macOS | PowerShell | What it does |
|---|---|---|
mkdir -p a/b | New-Item -ItemType Directory a\b | Create folder (-p = including subfolders) |
cp bron doel | Copy-Item bron doel | Copy (-r for folders) |
mv oud nieuw | Move-Item oud nieuw | Move or rename |
rm bestand | Remove-Item bestand | Delete (there is no recycle bin!) |
cat bestand | Get-Content bestand | Show contents |
less bestand | more bestand | Browse through a long file (q=stop) |
head -n 20 / tail -n 20 | Get-Content -Head 20 / -Tail 20 | Start / end of a file |
tail -f log.txt | Get-Content log.txt -Wait | Monitoring a log file in real time |
tar -xzf a.tar.gz | tar -xzf a.tar.gz | Extract archive |
zip -r a.zip map / unzip a.zip | Compress-Archive / Expand-Archive | Zipping and unzipping |
03
Search
grep -rn "FactuurController" app/ # zoek tekst in bestanden, met regelnummers
which php # waar staat dit programma?
PowerShell: Select-String -Path app\*.php -Pattern "FactuurController" and Get-Command php.
04
Processes
| Command | What it does |
|---|---|
ps aux | Running processes |
top / htop | Real-time overview of CPU and memory |
kill 1234 | Stop process 1234 |
| Ctrl+C | Abort the command currently running |
05
The Internet and servers
curl -i https://jouwsite.nl # pagina ophalen met headers
wget https://example.com/bestand.zip # bestand downloaden
ssh gebruiker@server.nl # inloggen op een server
scp bestand.txt gebruiker@server.nl:/tmp/ # bestand naar een server kopiëren
06
Environment and rights
echo $PATH # een variabele tonen
export APP_ENV=local # variabele zetten voor deze sessie
env # alle variabelen tonen
source ~/.bashrc # instellingen opnieuw inladen
sudo commando # als beheerder uitvoeren (Linux/macOS)
chmod 644 bestand # rechten instellen
chown www-data:www-data storage -R # eigenaar wijzigen
07
Combining commands
|(pipe) redirects the output:cat laravel.log | grep ERROR&&only executes the second command if the first one succeeded:composer install && php artisan migrate>writes to a file (overwrites it),>>appends to it
08
Flags: what do those letters mean?
Flags change what a command does. The same letter does not mean the same thing everywhere. If in doubt, always check the help: commando --help or man commando.
| Flag | Usually | But please note |
|---|---|---|
-a / --all | everything, including hidden files | git commit -a adds all modified files to the commit |
-f / --force | force | docker compose -f and tar -f mean ‘file’ |
-r / -R | recursive (including subfolders) | |
-v | verbose output | node -v = version, grep -v = do not match |
-n / --dry-run | show only what would happen | grep -n = line numbers |
-q | silent | |
-y / --yes | answer "yes" to everything | |
-h / --help | help | df -h = human-readable sizes |
09
Danger: think first
rm -rf mapdeletes everything without asking. Check the directory first usingls.chmod -R 777gives everyone full access. Never do this.- Use
sudofor anything you don’t understand. - Paste internet commands that end with
| bash.
Don’t let your AI assistant carry out such commands without asking first. The cli-flag-safety skill can help with this.
10
Need help?
Would you like an assistant that works securely on your terminal, with the right permissions and restrictions? Take a look at Your own coding agent.
11
Skills
- [CLI flag safety] (/nl/skills/cli-flag-safety)
- [Bash Defensive Patterns] (/nl/skills/bash-defensive-patterns)
- [ShellCheck Configuration and Static Analysis] (/nl/skills/shellcheck-configuration)
- [Debian Linux Triage] (/nl/skills/debian-linux-triage)
12
Related services
- [Je eigen programmeeragent] (/nl/services#service-06)