Linux-commando’s cheatsheet
Doorzoekbare lijst met essentiële Linux-commando’s voor bestanden, rechten, tekst, processen, services, netwerk en gebruikers.
Draait in je browser · er wordt niets verstuurd
Commando’s voor pakketten, services, firewall en netwerk verschillen per distributie. Kies de jouwe om het juiste commando te zien.
89 commando’s
ls -lahList files with details, hidden files and readable sizes.
ls -lahList files with details, hidden files and readable sizes.Shows permissions, owner, size and modification time per file.
Opties
-l | Long format. |
|---|---|
-a | Include hidden files (starting with a dot). |
-h | Human-readable sizes (K, M, G). |
-t | Newest first. |
-R | Recurse into subfolders. |
cd -Go back to the previous directory.
cd -Go back to the previous directory.cd alone goes to your home folder. cd .. goes one level up.
pwdPrint the current directory.
pwdPrint the current directory.Handy in scripts and when your prompt is shortened. pwd -P resolves symbolic links to the real path.
cp -a <src> <dst>Copy files or folders, keeping permissions and timestamps.
cp -a <src> <dst>Copy files or folders, keeping permissions and timestamps.Opties
-a | Archive: recursive and preserves attributes. |
|---|---|
-r | Recursive (folders). |
-i | Ask before overwriting. |
-v | Show what is copied. |
mv <src> <dst>Move or rename files and folders.
mv <src> <dst>Move or rename files and folders.Moving within the same filesystem is instant; across filesystems it copies and then deletes.
Opties
-i | Ask before overwriting. |
|---|---|
-n | Never overwrite. |
rm -rf <path>Delete files or folders recursively without asking.
rm -rf <path>Delete files or folders recursively without asking.Opties
-r | Recursive (needed for folders). |
|---|---|
-f | Force: no questions, ignore missing files. |
-i | Ask for each file. |
mkdir -p a/b/cCreate nested directories in one go.
mkdir -p a/b/cCreate nested directories in one go.-p creates missing parents and does not complain if the folder already exists.
touch <file>Create an empty file or update its modification time.
touch <file>Create an empty file or update its modification time.If the file already exists only its timestamps change. You can create several files at once: touch a.txt b.txt.
ln -s <target> <link>Create a symbolic link (shortcut) to a file or folder.
ln -s <target> <link>Create a symbolic link (shortcut) to a file or folder.The first argument is where the link points to; the second is the new link name.
Voorbeeld
ln -s /var/www/site /home/me/site
find <path> -name "*.log" -mtime -1Find files by name, type, size or age.
find <path> -name "*.log" -mtime -1Find files by name, type, size or age.Voorbeeld
find /var/log -type f -name "*.log" -size +100M
Opties
-name "<pattern>" | Match the file name (case-sensitive; -iname ignores case). |
|---|---|
-type f|d | Only files or only directories. |
-mtime -1 | Modified in the last day (+7 means older than 7 days). |
-size +100M | Larger than 100 MB. |
-exec <cmd> {} \; | Run a command on each match. |
du -sh *Show how much space each item in the current folder uses.
du -sh *Show how much space each item in the current folder uses.Voorbeeld
du -h -d 1 /var | sort -h
Opties
-s | Summary per argument. |
|---|---|
-h | Human-readable sizes. |
-d 1 | Only one level deep. Works with GNU and BusyBox; the long form --max-depth=1 is GNU only. |
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | BusyBox du understands -d N but not --max-depth. |
|---|
df -hShow free and used space per filesystem.
df -hShow free and used space per filesystem.Use df -i to check inodes: a disk can be “full” because it ran out of inodes, not bytes.
tar -czvf archive.tar.gz <dir>Create a gzip-compressed archive.
tar -czvf archive.tar.gz <dir>Create a gzip-compressed archive.Opties
c | Create. |
|---|---|
z | Compress with gzip. |
v | Verbose: list files. |
f | Archive file name (must come last in the option group). |
tar -xzvf archive.tar.gzExtract a gzip-compressed archive.
tar -xzvf archive.tar.gzExtract a gzip-compressed archive.Voorbeeld
tar -xzvf archive.tar.gz -C /opt/app
Opties
x | Extract. |
|---|---|
-C <dir> | Extract into this directory. |
-t | List contents without extracting. |
chmod 644 <file>Change who can read, write or execute a file.
chmod 644 <file>Change who can read, write or execute a file.Numbers: 4 = read, 2 = write, 1 = execute, added per owner, group and others. 644 = owner rw, others read. 755 = owner rwx, others rx. Try the chmod calculator on this site.
Voorbeeld
chmod u+x script.sh
Opties
-R | Apply recursively. |
|---|---|
u+x | Symbolic: add execute for the owner. |
chown user:group <file>Change the owner and group of a file.
chown user:group <file>Change the owner and group of a file.The web server user differs per distribution: www-data on Debian and Ubuntu, nginx or apache on the Red Hat family, Fedora and Alpine, http on Arch and wwwrun on openSUSE. Check with ps aux | grep -E "nginx|apache|httpd".
Voorbeeld
chown -R www-data:www-data /var/www/site
Opties
-R | Apply recursively. |
|---|
umask 022Set default permissions for new files in this shell.
umask 022Set default permissions for new files in this shell.umask 022 gives new files 644 and folders 755. See the umask calculator on this site.
Opmerkingen per distributie
| openSUSE Leap 16 / Tumbleweed / SLES | On openSUSE Leap 16 new users get a private primary group (named after the user), so files are not group-readable by other users by default. |
|---|
Verschilt per distributieOpen a root shell.
Prefer running single commands with sudo <cmd> so you do not stay root by accident.
Verschilt per distributie
| Debian 13 / 12 | sudo -i If you set a root password during installation, sudo is not installed. Log in with su - and run the command without sudo, or install it first with apt install sudo. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo -i Ubuntu 25.10 and newer, including 26.04 LTS, use sudo-rs, a Rust rewrite of sudo that is meant as a drop-in replacement. The common options work the same. |
| RHEL / Rocky / Alma 10 / 9 | sudo -i |
| Fedora 44 / 45 | sudo -i |
| Arch / Manjaro (rolling) | sudo -i sudo is not installed by default on Arch. Install it with pacman -S sudo and allow the wheel group with visudo. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo -i |
| Alpine 3.23 / 3.24 | su - Alpine has no sudo by default. Run as root (su -), or install doas or sudo. The dash loads root’s environment. |
Verschilt per distributieRepeat the previous command with sudo.
Handy after “permission denied”. This is bash history expansion, so it works in bash and zsh.
Verschilt per distributie
| Debian 13 / 12 | sudo !! If you set a root password during installation, sudo is not installed. Log in with su - and run the command without sudo, or install it first with apt install sudo. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo !! |
| RHEL / Rocky / Alma 10 / 9 | sudo !! |
| Fedora 44 / 45 | sudo !! |
| Arch / Manjaro (rolling) | sudo !! Needs sudo to be installed and bash or zsh as your shell. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo !! |
cat <file>Print a file to the terminal.
cat <file>Print a file to the terminal.For long files use less. cat a b > c joins files.
less <file>Scroll through a file page by page.
less <file>Scroll through a file page by page.Opties
/text | Search forward (n = next match). |
|---|---|
G / g | Jump to the end / start. |
q | Quit. |
F | Follow new lines like tail -f (Ctrl+C to stop). |
tail -f /var/log/syslogFollow a log file live as new lines arrive.
tail -f /var/log/syslogFollow a log file live as new lines arrive.The log file name differs per distribution. Where text logs exist, Debian and Ubuntu use /var/log/syslog, the Red Hat family and Alpine use /var/log/messages. If the file is missing, the system only logs to the journal: use journalctl -f.
Opties
-n 100 | Start with the last 100 lines. |
|---|---|
-F | Keep following when the file is rotated. |
Opmerkingen per distributie
| Debian 13 / 12 | Debian 12 and newer do not install rsyslog by default, so /var/log/syslog may not exist. Use journalctl -f. |
|---|---|
| Fedora 44 / 45 | Fedora no longer writes /var/log/messages by default. Use journalctl -f. |
| Arch / Manjaro (rolling) | Arch has no /var/log/syslog. Use journalctl -f. |
| openSUSE Leap 16 / Tumbleweed / SLES | Current openSUSE releases usually log only to the journal. Use journalctl -f. |
head -n 20 <file>Show the first 20 lines of a file.
head -n 20 <file>Show the first 20 lines of a file.The default is 10 lines. Combine with tail to show a range: head -n 50 file | tail -n 10.
Opties
-n <num> | Number of lines. |
|---|---|
-c <num> | Number of bytes. |
grep -rni "text" .Search for text in files, recursively and case-insensitive.
grep -rni "text" .Search for text in files, recursively and case-insensitive.Voorbeeld
grep -rn --include="*.conf" "ssl" /etc
Opties
-r | Recursive. |
|---|---|
-n | Show line numbers. |
-i | Ignore case. |
-v | Invert: lines that do not match. |
-E | Extended regular expressions. |
-C 3 | Show 3 lines of context around each match. |
sed -i "s/old/new/g" <file>Replace text in a file in place.
sed -i "s/old/new/g" <file>Replace text in a file in place.Opties
-i | Edit the file directly. Use -i.bak to keep a backup. |
|---|---|
s/a/b/g | Substitute a with b everywhere on each line. |
awk '{print $1}' <file>Print the first column of each line.
awk '{print $1}' <file>Print the first column of each line.Voorbeeld
awk -F: '{print $1}' /etc/passwdOpties
-F: | Use : as the field separator. |
|---|
Opmerkingen per distributie
| Debian 13 / 12 | Debian ships mawk as the default awk. Basic scripts work, but GNU extensions need gawk (apt install gawk). |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | Ubuntu ships mawk as the default awk. GNU extensions such as gensub need gawk (apt install gawk). |
| Alpine 3.23 / 3.24 | Alpine uses BusyBox awk. For GNU awk features install gawk. |
sort | uniq -c | sort -nrCount identical lines and rank them.
sort | uniq -c | sort -nrCount identical lines and rank them.Classic way to find the most frequent IP addresses or errors in a log.
Voorbeeld
awk '{print $1}' access.log | sort | uniq -c | sort -nr | headwc -l <file>Count lines.
wc -l <file>Count lines.Without a file name it counts what you pipe in, for example ls | wc -l.
Opties
-w | Words. |
|---|---|
-c | Bytes. |
cut -d: -f1 /etc/passwdPick a column from delimited text.
cut -d: -f1 /etc/passwdPick a column from delimited text.Opties
-d: | Delimiter. |
|---|---|
-f1,3 | Fields to keep. |
xargsTurn lines of input into arguments for another command.
xargsTurn lines of input into arguments for another command.Voorbeeld
find . -name "*.tmp" | xargs rm
Opties
-n 1 | One argument per command run. |
|---|---|
-0 | Input is NUL-separated (use with find -print0). |
ps auxList all running processes.
ps auxList all running processes.Columns include user, PID, CPU and memory usage and the command.
Voorbeeld
ps aux | grep nginx
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | BusyBox ps does not understand the aux style and prints fewer columns. Install procps-ng for the full GNU ps, or use ps -o pid,user,args. |
|---|
top (or htop)Live overview of processes and resource use.
top (or htop)Live overview of processes and resource use.Opties
q | Quit. |
|---|---|
M / P | Sort by memory / CPU (in top). |
k | Kill a process (in top). |
Opmerkingen per distributie
| Debian 13 / 12 | htop is not installed by default: apt install htop. |
|---|---|
| RHEL / Rocky / Alma 10 / 9 | htop is not in the base repositories. Enable EPEL first (on Rocky and Alma: dnf install epel-release), then dnf install htop. |
| Alpine 3.23 / 3.24 | BusyBox top is limited. Install htop with apk add htop. |
kill <pid>Ask a process to stop. Use kill -9 to force it.
kill <pid>Ask a process to stop. Use kill -9 to force it.The default signal (TERM) lets the program clean up. Try that first.
Opties
-15 | TERM: polite request (default). |
|---|---|
-9 | KILL: immediate, no cleanup. |
-HUP | Often makes daemons reload their config. |
pkill <name>Stop processes by name.
pkill <name>Stop processes by name.Matches part of the process name, so check with pgrep -l <name> first.
Opties
-f | Match against the full command line. |
|---|
nohup <cmd> &Run a command in the background that survives logout.
nohup <cmd> &Run a command in the background that survives logout.Output goes to nohup.out. For serious jobs use a systemd service (OpenRC on Alpine) or tmux.
ip aShow network interfaces and IP addresses.
ip aShow network interfaces and IP addresses.Replaces the old ifconfig, which is not installed on many modern systems.
Opties
-br a | Brief, one line per interface. |
|---|
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | The ip command on Alpine is a BusyBox applet with fewer options (no -br). Install iproute2 for the full version. |
|---|
ip rShow the routing table, including the default gateway.
ip rShow the routing table, including the default gateway.The line starting with “default via” is your default gateway. Add a temporary route with sudo ip route add 10.0.0.0/24 via 192.168.1.1; it is lost after a reboot.
ss -tulpnList listening ports and which process owns them.
ss -tulpnList listening ports and which process owns them.Needs root (sudo) to show the process names.
Opties
-t / -u | TCP / UDP. |
|---|---|
-l | Listening sockets only. |
-p | Show the process. |
-n | Numeric ports, no name lookups. |
Veelgebruikte netwerkpoorten openen →
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | ss is not part of BusyBox. Install it with apk add iproute2-ss, or use netstat -tulpn. |
|---|
ping -c 4 <host>Check whether a host answers, 4 times.
ping -c 4 <host>Check whether a host answers, 4 times.Without -c, ping runs until you press Ctrl+C. Some firewalls block ICMP, so no answer does not always mean down.
traceroute <host>Show the route packets take to a host.
traceroute <host>Show the route packets take to a host.Alternatives: tracepath, or mtr for a live view.
Opmerkingen per distributie
| Debian 13 / 12 | Not installed by default: apt install traceroute. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | Not installed by default: apt install traceroute. |
| RHEL / Rocky / Alma 10 / 9 | Not installed by default: dnf install traceroute. |
| Fedora 44 / 45 | Not installed by default: dnf install traceroute. |
| Arch / Manjaro (rolling) | Not installed by default: pacman -S traceroute. |
| Alpine 3.23 / 3.24 | BusyBox includes a basic traceroute applet. |
dig <domain> +shortLook up DNS records.
dig <domain> +shortLook up DNS records.Voorbeeld
dig MX example.com +short
Opties
@8.8.8.8 | Ask a specific DNS server. |
|---|---|
+short | Only the answer. |
-x <ip> | Reverse lookup. |
Opmerkingen per distributie
| Debian 13 / 12 | Not installed by default. The package is bind9-dnsutils. On Debian 13 the old name dnsutils may no longer work. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | Not installed on minimal installs. The package is bind9-dnsutils. |
| RHEL / Rocky / Alma 10 / 9 | Not installed on minimal installs. The package is bind-utils. |
| Fedora 44 / 45 | Not installed on minimal installs. The package is bind-utils. |
| Arch / Manjaro (rolling) | The dig command is part of the bind package: pacman -S bind. |
| openSUSE Leap 16 / Tumbleweed / SLES | Not installed on minimal installs. The package is bind-utils. |
| Alpine 3.23 / 3.24 | Not installed by default. The package is bind-tools: apk add bind-tools. |
curl -I <url>Fetch only the HTTP response headers.
curl -I <url>Fetch only the HTTP response headers.Opties
-L | Follow redirects. |
|---|---|
-v | Verbose: show the whole exchange. |
-k | Skip certificate checks (testing only). |
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | curl is not installed by default (BusyBox has wget): apk add curl. |
|---|
curl -fsSL <url> | bashDownload a script and run it immediately.
curl -fsSL <url> | bashDownload a script and run it immediately.wget -c <url>Download a file and resume if interrupted.
wget -c <url>Download a file and resume if interrupted.Saves to the current folder. Good for large downloads on unreliable connections.
Opties
-c | Continue a partial download. |
|---|---|
-O <name> | Choose the output file name. |
-q | Quiet. |
-r | Download recursively (mirror a site). |
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | The default wget is the BusyBox version with fewer options. Install the full wget with apk add wget if you need them. |
|---|
ssh user@hostOpen a secure shell on another machine.
ssh user@hostOpen a secure shell on another machine.Opties
-p 2222 | Use another port. |
|---|---|
-i ~/.ssh/key | Use a specific private key. |
-L 8080:localhost:80 | Forward a local port through the connection. |
Opmerkingen per distributie
| openSUSE Leap 16 / Tumbleweed / SLES | openSUSE Leap 16 only allows key-based SSH logins by default (password login is off). Add your public key with ssh-copy-id. |
|---|---|
| Alpine 3.23 / 3.24 | The ssh client is not installed by default: apk add openssh-client. |
ssh-keygen -t ed25519Create a modern SSH key pair.
ssh-keygen -t ed25519Create a modern SSH key pair.Protect the key with a passphrase. Copy the public key to a server with ssh-copy-id user@host.
scp <file> user@host:/pathCopy a file to or from another machine over SSH.
scp <file> user@host:/pathCopy a file to or from another machine over SSH.Opties
-r | Copy folders. |
|---|---|
-P 2222 | Port (capital P). |
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | Part of the openssh-client packages: apk add openssh-client. |
|---|
rsync -avz <src> user@host:<dst>Efficiently sync files and folders, copying only what changed.
rsync -avz <src> user@host:<dst>Efficiently sync files and folders, copying only what changed.A trailing slash on the source matters: src/ copies the contents, src copies the folder itself. rsync must be installed on both machines.
Opties
-a | Archive: recursive, keeps permissions and times. |
|---|---|
-v | Verbose. |
-z | Compress during transfer. |
-n | Dry run: show what would happen. |
--delete | Remove files on the target that no longer exist on the source. |
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | Not installed by default: apk add rsync. |
|---|
nc -zv <host> <port>Test whether a TCP port is reachable.
nc -zv <host> <port>Test whether a TCP port is reachable.Reports “succeeded” (or “open”) when the port answers. There are several netcat versions with slightly different options. Without any extra tool you can test in bash.
Voorbeeld
timeout 3 bash -c '</dev/tcp/example.com/443' && echo open || echo closed
Opmerkingen per distributie
| Debian 13 / 12 | Install netcat-openbsd. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | Install netcat-openbsd. |
| RHEL / Rocky / Alma 10 / 9 | Install nmap-ncat. |
| Fedora 44 / 45 | Install nmap-ncat. |
| Arch / Manjaro (rolling) | Install openbsd-netcat. |
| openSUSE Leap 16 / Tumbleweed / SLES | Install netcat-openbsd. |
| Alpine 3.23 / 3.24 | The built-in BusyBox nc has fewer options. For the full version install netcat-openbsd. The bash example needs bash (apk add bash). |
Verschilt per distributieFind out which tool manages the network on this machine.
The answer decides which commands and config files you use. Debian and Ubuntu can run on ifupdown, NetworkManager, systemd-networkd or netplan, depending on how they were installed. The command prints “active” next to the services that are running.
Opmerkingen per distributie
| Debian 13 / 12 | Server installs often use ifupdown (the networking service), desktop installs NetworkManager, and cloud images netplan with systemd-networkd. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | Ubuntu uses netplan as the front-end. It drives systemd-networkd on servers and NetworkManager on desktops. |
| RHEL / Rocky / Alma 10 / 9 | RHEL and its clones use NetworkManager. RHEL 10 removed the old ifcfg-style files; connection profiles are NetworkManager keyfiles. |
| Fedora 44 / 45 | Fedora uses NetworkManager. |
| openSUSE Leap 16 / Tumbleweed / SLES | openSUSE Leap 16 uses NetworkManager only; wicked is gone. Leap 15 and SLES 15 servers can still use wicked. |
Verschilt per distributie
| Debian 13 / 12 | systemctl is-active NetworkManager systemd-networkd networking |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | systemctl is-active NetworkManager systemd-networkd networking |
| RHEL / Rocky / Alma 10 / 9 | systemctl is-active NetworkManager systemd-networkd networking |
| Fedora 44 / 45 | systemctl is-active NetworkManager systemd-networkd networking |
| Arch / Manjaro (rolling) | systemctl is-active NetworkManager systemd-networkd networking |
| openSUSE Leap 16 / Tumbleweed / SLES | systemctl is-active NetworkManager systemd-networkd networking |
| Alpine 3.23 / 3.24 | rc-service networking status Alpine configures the network in /etc/network/interfaces. |
Verschilt per distributieApply a changed network configuration.
Which command applies when you use depends on the tool found with the previous entry.
Verschilt per distributie
| Debian 13 / 12 | sudo systemctl restart networking For ifupdown (/etc/network/interfaces). With systemd-networkd use sudo networkctl reload; with NetworkManager use sudo nmcli connection reload and then sudo nmcli connection up <name>; on cloud images with netplan use sudo netplan try. On a fresh Debian without sudo, log in with su -. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo netplan try Applies the change and rolls back after 120 seconds unless you confirm, which protects remote sessions. Use sudo netplan apply to apply permanently without the safety net. |
| RHEL / Rocky / Alma 10 / 9 | sudo nmcli connection reload && sudo nmcli connection up <name> Profiles are NetworkManager keyfiles in /etc/NetworkManager/system-connections/. RHEL 10 no longer supports the old ifcfg format; RHEL 9 deprecated it. |
| Fedora 44 / 45 | sudo nmcli connection reload && sudo nmcli connection up <name> |
| Arch / Manjaro (rolling) | sudo networkctl reload For systemd-networkd, then sudo networkctl reconfigure <interface>. If you use NetworkManager, use sudo nmcli connection reload. Arch does not choose for you. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo nmcli connection reload && sudo nmcli connection up <name> Leap 16 and Tumbleweed use NetworkManager. On Leap 15 and SLES 15 with wicked use sudo wicked ifreload all. |
| Alpine 3.23 / 3.24 | rc-service networking restart Edit /etc/network/interfaces first. Restarting over SSH drops the connection while it runs. |
Verschilt per distributieShow the firewall status and rules.
The default firewall differs a lot: Ubuntu ships ufw (switched off), the Red Hat family, Fedora and openSUSE Leap 16 run firewalld, and Debian, Arch and Alpine have no firewall enabled by default.
Verschilt per distributie
| Debian 13 / 12 | sudo nft list ruleset Debian enables no firewall by default. Install a front-end such as ufw (apt install ufw) if you want one. An empty result means no rules are loaded. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo ufw status verbose ufw is installed but inactive until you enable it. |
| RHEL / Rocky / Alma 10 / 9 | sudo firewall-cmd --list-all firewalld is enabled by default. Check it runs with systemctl is-active firewalld. |
| Fedora 44 / 45 | sudo firewall-cmd --list-all firewalld is enabled by default. |
| Arch / Manjaro (rolling) | sudo nft list ruleset Arch enables no firewall by default. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo firewall-cmd --list-all firewalld is the default on Leap 16. Older Leap 15 releases also use firewalld (it replaced SuSEfirewall2). |
| Alpine 3.23 / 3.24 | nft list ruleset No firewall by default. Install nftables or iptables first (apk add nftables). |
Verschilt per distributieOpen TCP port 443 in the firewall.
Verschilt per distributie
| Debian 13 / 12 | sudo ufw allow 443/tcp ufw is not installed by default on Debian: sudo apt install ufw. Allow SSH first with sudo ufw allow 22/tcp, then sudo ufw enable. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo ufw allow 443/tcp Allow SSH first (sudo ufw allow OpenSSH) before running sudo ufw enable. |
| RHEL / Rocky / Alma 10 / 9 | sudo firewall-cmd --permanent --add-service=https && sudo firewall-cmd --reload For a custom port use --add-port=8443/tcp. Without --permanent the rule disappears after a reload or reboot. |
| Fedora 44 / 45 | sudo firewall-cmd --permanent --add-service=https && sudo firewall-cmd --reload |
| Arch / Manjaro (rolling) | sudo nft add rule inet filter input tcp dport 443 accept Needs an existing inet filter table and input chain. Put the rule in /etc/nftables.conf and run sudo systemctl enable --now nftables to make it permanent. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo firewall-cmd --permanent --add-service=https && sudo firewall-cmd --reload |
| Alpine 3.23 / 3.24 | iptables -A INPUT -p tcp --dport 443 -j ACCEPT Install iptables first (apk add iptables). Save with rc-service iptables save and enable it at boot with rc-update add iptables. |
uname -aKernel version and system information.
uname -aKernel version and system information.For the distribution name and version use cat /etc/os-release instead.
Opties
-r | Kernel release only. |
|---|---|
-m | Architecture, for example x86_64 or aarch64. |
-n | Hostname. |
cat /etc/os-releaseShow which distribution and version this is.
cat /etc/os-releaseShow which distribution and version this is.Works on every modern distribution, Alpine included, and is the reliable way to detect it in scripts. Check the ID and VERSION_ID fields.
uptimeHow long the system has been running, plus the load average.
uptimeHow long the system has been running, plus the load average.Load average over 1, 5 and 15 minutes. A value above the number of CPU cores means the system is overloaded.
free -hMemory and swap usage.
free -hMemory and swap usage.Look at the “available” column rather than “free”: Linux uses spare memory for caching.
lsblkList disks and partitions as a tree.
lsblkList disks and partitions as a tree.Opties
-f | Show filesystem type, label and UUID. |
|---|
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | lsblk is part of util-linux and is not in BusyBox. Install it from the util-linux packages; df -h and mount work without it. |
|---|
lsof -i :80Which process uses port 80?
lsof -i :80Which process uses port 80?Also useful to see which process keeps a deleted file open: lsof +L1.
Opmerkingen per distributie
| Alpine 3.23 / 3.24 | BusyBox has only a minimal lsof. Install the real one with apk add lsof. |
|---|
Verschilt per distributieKernel messages with readable timestamps.
Check here for disk errors, out-of-memory kills and hardware problems. Many distributions only let root read the kernel log, hence sudo.
Verschilt per distributie
| Debian 13 / 12 | sudo dmesg -T | tail If you set a root password during installation, sudo is not installed. Log in with su - and run the command without sudo, or install it first with apt install sudo. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo dmesg -T | tail |
| RHEL / Rocky / Alma 10 / 9 | sudo dmesg -T | tail |
| Fedora 44 / 45 | sudo dmesg -T | tail |
| Arch / Manjaro (rolling) | sudo dmesg -T | tail |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo dmesg -T | tail |
| Alpine 3.23 / 3.24 | dmesg | tail Run as root. The BusyBox dmesg has no -T option, so timestamps are in seconds since boot. Install the util-linux version for readable timestamps. |
crontab -eEdit your scheduled jobs.
crontab -eEdit your scheduled jobs.Format: minute hour day month weekday command. See the cron explainer on this site.
Opties
-l | List your jobs. |
|---|
Opmerkingen per distributie
| RHEL / Rocky / Alma 10 / 9 | The cron daemon is the cronie package. Check that crond runs: systemctl status crond. |
|---|---|
| Fedora 44 / 45 | The cron daemon is the cronie package (not always installed). systemd timers are the alternative. |
| Arch / Manjaro (rolling) | Arch installs no cron by default. Install cronie and enable cronie.service, or use systemd timers. |
| openSUSE Leap 16 / Tumbleweed / SLES | Install cron if it is missing. systemd timers are the alternative. |
| Alpine 3.23 / 3.24 | BusyBox crond is not started by default: rc-update add crond default and rc-service crond start. |
history | grep <text>Search your command history.
history | grep <text>Search your command history.Press Ctrl+R in the shell for interactive reverse search.
Verschilt per distributieSet the time zone.
List valid names with timedatectl list-timezones on systemd systems. Check the result with date.
Verschilt per distributie
| Debian 13 / 12 | sudo timedatectl set-timezone Europe/Amsterdam |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo timedatectl set-timezone Europe/Amsterdam |
| RHEL / Rocky / Alma 10 / 9 | sudo timedatectl set-timezone Europe/Amsterdam |
| Fedora 44 / 45 | sudo timedatectl set-timezone Europe/Amsterdam |
| Arch / Manjaro (rolling) | sudo timedatectl set-timezone Europe/Amsterdam |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo timedatectl set-timezone Europe/Amsterdam |
| Alpine 3.23 / 3.24 | setup-timezone -z Europe/Amsterdam Needs the tzdata package: apk add tzdata. Alpine has no systemd, so no timedatectl. |
Verschilt per distributieDoes the system need a reboot after updates?
A reboot is needed after kernel, glibc/libc or systemd updates. Services can often be restarted instead.
Verschilt per distributie
| Debian 13 / 12 | sudo needrestart -r l Install it first: apt install needrestart. It lists services that run old library code and tells you if the kernel is outdated. Debian does not create /var/run/reboot-required by default. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | cat /var/run/reboot-required The file only exists when a reboot is pending. /var/run/reboot-required.pkgs lists the packages. needrestart (sudo needrestart -r l) lists services to restart. |
| RHEL / Rocky / Alma 10 / 9 | sudo dnf needs-restarting -r Needs the dnf-utils package. Exit code 1 means a reboot is recommended; 0 means no reboot needed. Add -s to list services to restart. |
| Fedora 44 / 45 | sudo dnf needs-restarting -r Part of the dnf5 plugins. Exit code 1 means a reboot is recommended. |
| Arch / Manjaro (rolling) | uname -r && pacman -Q linux Reboot when the running kernel version differs from the installed one. Replace linux with your kernel package (linux-lts, linux-zen). |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo zypper needs-rebooting sudo zypper ps -s lists processes that use deleted files and need a restart. |
Verschilt per distributieRefresh the list of available packages.
Downloads the latest package information from the repositories. Does not install anything on most systems.
Verschilt per distributie
| Debian 13 / 12 | sudo apt update If you set a root password during installation, sudo is not installed. Log in with su - and run the command without sudo, or install it first with apt install sudo. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo apt update |
| RHEL / Rocky / Alma 10 / 9 | sudo dnf check-update Exit code 100 means updates are available; that is not an error. dnf refreshes its metadata by itself when needed (force it with sudo dnf makecache). |
| Fedora 44 / 45 | sudo dnf check-upgrade --refresh Exit code 100 means updates are available. Fedora 41 and newer use dnf5, a rewrite of dnf. The everyday commands are the same. |
| Arch / Manjaro (rolling) | sudo pacman -Sy Never install packages after a lone -Sy: partial upgrades can break Arch. Use sudo pacman -Syu to refresh and upgrade together. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo zypper refresh Leap 16 has no separate update repository any more; the main repositories carry updates as well. |
| Alpine 3.23 / 3.24 | apk update Run as root. Alpine has no sudo by default. Run as root (su -), or install doas or sudo. |
Verschilt per distributieUpgrade all installed packages.
Review what will change before confirming. Reboot afterwards if the kernel or core libraries were updated.
Verschilt per distributie
| Debian 13 / 12 | sudo apt update && sudo apt upgrade When apt reports packages that were kept back, use sudo apt full-upgrade: it may install or remove packages to resolve dependencies. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo apt update && sudo apt upgrade Use sudo apt full-upgrade when packages are kept back. To move to a new Ubuntu release use do-release-upgrade. |
| RHEL / Rocky / Alma 10 / 9 | sudo dnf upgrade Add --security to install only security updates. update is a synonym of upgrade. |
| Fedora 44 / 45 | sudo dnf upgrade --refresh Add --offline to stage the update and install it during the next reboot, which is safer for kernel and desktop updates. |
| Arch / Manjaro (rolling) | sudo pacman -Syu Read the news at archlinux.org before big upgrades, reboot after a kernel update and never interrupt an upgrade. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo zypper update On Tumbleweed (rolling) use sudo zypper dup instead. On Leap do not use dup to upgrade packages; reaching for it out of habit can pull a stable system apart. |
| Alpine 3.23 / 3.24 | apk update && apk upgrade This stays within your Alpine release. To move to a new release change the version in /etc/apk/repositories and run apk upgrade --available. |
Verschilt per distributieInstall a package.
Replace <pkg> with the package name, for example nginx. Several packages can be listed at once.
Verschilt per distributie
| Debian 13 / 12 | sudo apt install <pkg> |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo apt install <pkg> |
| RHEL / Rocky / Alma 10 / 9 | sudo dnf install <pkg> Many extras (such as htop) live in EPEL. On Rocky and AlmaLinux: sudo dnf install epel-release. RHEL itself needs its own steps to enable EPEL. |
| Fedora 44 / 45 | sudo dnf install <pkg> |
| Arch / Manjaro (rolling) | sudo pacman -S <pkg> This only installs from the official repositories. AUR packages need an AUR helper or makepkg; read the PKGBUILD first. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo zypper install <pkg> Short form: zypper in <pkg>. |
| Alpine 3.23 / 3.24 | apk add <pkg> In Dockerfiles use apk add --no-cache <pkg> so no package index stays in the image. |
Verschilt per distributieRemove a package.
Removing may leave configuration files behind. Some systems have a purge option that removes those too.
Verschilt per distributie
| Debian 13 / 12 | sudo apt remove <pkg> sudo apt purge <pkg> also deletes its configuration files. sudo apt autoremove removes dependencies nothing needs any more. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo apt remove <pkg> sudo apt purge <pkg> also deletes its configuration files. |
| RHEL / Rocky / Alma 10 / 9 | sudo dnf remove <pkg> Dependencies pulled in only for this package are removed too (default behaviour). |
| Fedora 44 / 45 | sudo dnf remove <pkg> Unused dependencies are removed as well. |
| Arch / Manjaro (rolling) | sudo pacman -Rs <pkg> -Rs also removes dependencies that nothing else needs. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo zypper remove <pkg> Short form: zypper rm <pkg>. |
| Alpine 3.23 / 3.24 | apk del <pkg> Also removes dependencies that became orphans. Configuration files you edited are kept. |
Verschilt per distributieSearch for a package by name or description.
Searches names and descriptions. The package name to install is the first word of each result. Pipe to grep to narrow down long lists.
Verschilt per distributie
| Debian 13 / 12 | apt search <text> |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | apt search <text> |
| RHEL / Rocky / Alma 10 / 9 | dnf search <text> |
| Fedora 44 / 45 | dnf search <text> |
| Arch / Manjaro (rolling) | pacman -Ss <text> |
| openSUSE Leap 16 / Tumbleweed / SLES | zypper search <text> |
| Alpine 3.23 / 3.24 | apk search -v <text> The -v option shows the description next to each package. |
Verschilt per distributieShow details about a package (version, size, dependencies).
Verschilt per distributie
| Debian 13 / 12 | apt show <pkg> |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | apt show <pkg> |
| RHEL / Rocky / Alma 10 / 9 | dnf info <pkg> |
| Fedora 44 / 45 | dnf info <pkg> |
| Arch / Manjaro (rolling) | pacman -Si <pkg> Use pacman -Qi for a package that is already installed. |
| openSUSE Leap 16 / Tumbleweed / SLES | zypper info <pkg> |
| Alpine 3.23 / 3.24 | apk info -a <pkg> Without -a only the description is shown. |
Verschilt per distributieList installed packages.
Pipe to grep to check for one package, for example the Debian command followed by | grep nginx.
Verschilt per distributie
| Debian 13 / 12 | apt list --installed |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | apt list --installed |
| RHEL / Rocky / Alma 10 / 9 | dnf list --installed |
| Fedora 44 / 45 | dnf list --installed |
| Arch / Manjaro (rolling) | pacman -Q |
| openSUSE Leap 16 / Tumbleweed / SLES | zypper search --installed-only |
| Alpine 3.23 / 3.24 | apk list --installed |
Verschilt per distributieWhich installed package does a file belong to?
Only works for files that are already on the system. To find a package for a command that is not installed yet, see the next entry.
Verschilt per distributie
| Debian 13 / 12 | dpkg -S /path/to/file |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | dpkg -S /path/to/file |
| RHEL / Rocky / Alma 10 / 9 | rpm -qf /path/to/file |
| Fedora 44 / 45 | rpm -qf /path/to/file |
| Arch / Manjaro (rolling) | pacman -Qo /path/to/file |
| openSUSE Leap 16 / Tumbleweed / SLES | rpm -qf /path/to/file |
| Alpine 3.23 / 3.24 | apk info -W /path/to/file |
Verschilt per distributieWhich package provides a command that is not installed?
Useful after “command not found”: find the package, then install it.
Verschilt per distributie
| Debian 13 / 12 | apt-file search bin/dig Install the tool and its index first: sudo apt install apt-file && sudo apt-file update. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | apt-file search bin/dig Install the tool and its index first: sudo apt install apt-file && sudo apt-file update. |
| RHEL / Rocky / Alma 10 / 9 | dnf provides "*/bin/dig" |
| Fedora 44 / 45 | dnf provides "*/bin/dig" |
| Arch / Manjaro (rolling) | pacman -F dig Download the file database first: sudo pacman -Fy. |
| openSUSE Leap 16 / Tumbleweed / SLES | zypper search --provides /usr/bin/dig zypper cannot look inside packages that are not installed. This finds many main binaries, but not every file. |
| Alpine 3.23 / 3.24 | apk search -v <name> This searches package names and descriptions. To find which package contains a particular file, use the Contents search on pkgs.alpinelinux.org/contents. |
Verschilt per distributieList the files installed by a package.
Shows where a package put its binaries, configuration and documentation. Handy for finding a program’s config file.
Verschilt per distributie
| Debian 13 / 12 | dpkg -L <pkg> |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | dpkg -L <pkg> |
| RHEL / Rocky / Alma 10 / 9 | rpm -ql <pkg> |
| Fedora 44 / 45 | rpm -ql <pkg> |
| Arch / Manjaro (rolling) | pacman -Ql <pkg> |
| openSUSE Leap 16 / Tumbleweed / SLES | rpm -ql <pkg> |
| Alpine 3.23 / 3.24 | apk info -L <pkg> |
Verschilt per distributieInstall a package file you downloaded.
Verschilt per distributie
| Debian 13 / 12 | sudo apt install ./file.deb Resolves dependencies, unlike dpkg -i. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo apt install ./file.deb Resolves dependencies, unlike dpkg -i. |
| RHEL / Rocky / Alma 10 / 9 | sudo dnf install ./file.rpm |
| Fedora 44 / 45 | sudo dnf install ./file.rpm |
| Arch / Manjaro (rolling) | sudo pacman -U file.pkg.tar.zst |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo zypper install ./file.rpm |
Verschilt per distributieFree disk space: remove unused dependencies and cached downloads.
Verschilt per distributie
| Debian 13 / 12 | sudo apt autoremove && sudo apt clean |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo apt autoremove && sudo apt clean |
| RHEL / Rocky / Alma 10 / 9 | sudo dnf autoremove && sudo dnf clean all |
| Fedora 44 / 45 | sudo dnf autoremove && sudo dnf clean all |
| Arch / Manjaro (rolling) | sudo pacman -Sc Removes cached packages that are no longer installed. -Scc empties the whole cache, after which you cannot downgrade from it. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo zypper clean --all |
| Alpine 3.23 / 3.24 | apk cache clean Only does something when package caching is set up (a /etc/apk/cache link). In containers use apk add --no-cache instead. |
Verschilt per distributieCheck whether a service is running.
systemd also shows the last log lines, which often reveal why a service failed. Service names differ per distribution: for example ssh on Debian and Ubuntu, sshd on RHEL, Fedora, Arch and openSUSE.
Verschilt per distributie
| Debian 13 / 12 | systemctl status <service> |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | systemctl status <service> |
| RHEL / Rocky / Alma 10 / 9 | systemctl status <service> |
| Fedora 44 / 45 | systemctl status <service> |
| Arch / Manjaro (rolling) | systemctl status <service> |
| openSUSE Leap 16 / Tumbleweed / SLES | systemctl status <service> |
| Alpine 3.23 / 3.24 | rc-service <service> status Alpine uses OpenRC instead of systemd. The SSH service is called sshd. |
Verschilt per distributieRestart a service.
Use reload instead of restart when the service supports it: no downtime.
Verschilt per distributie
| Debian 13 / 12 | sudo systemctl restart <service> |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo systemctl restart <service> |
| RHEL / Rocky / Alma 10 / 9 | sudo systemctl restart <service> |
| Fedora 44 / 45 | sudo systemctl restart <service> |
| Arch / Manjaro (rolling) | sudo systemctl restart <service> |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo systemctl restart <service> |
| Alpine 3.23 / 3.24 | rc-service <service> restart |
Verschilt per distributieStart a service now and at every boot.
On systemd, enable alone only affects the next boot; --now also starts it immediately. Undo with systemctl disable --now <service>.
Verschilt per distributie
| Debian 13 / 12 | sudo systemctl enable --now <service> Debian often starts a service right after installing its package. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo systemctl enable --now <service> Ubuntu usually starts a service right after installing its package. |
| RHEL / Rocky / Alma 10 / 9 | sudo systemctl enable --now <service> RHEL does not start services automatically after installation. |
| Fedora 44 / 45 | sudo systemctl enable --now <service> |
| Arch / Manjaro (rolling) | sudo systemctl enable --now <service> Arch does not start services automatically after installation. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo systemctl enable --now <service> |
| Alpine 3.23 / 3.24 | rc-update add <service> default && rc-service <service> start rc-update add makes it start at boot; rc-service starts it now. Use rc-update del <service> to undo. |
Verschilt per distributieList running services.
Verschilt per distributie
| Debian 13 / 12 | systemctl list-units --type=service --state=running |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | systemctl list-units --type=service --state=running |
| RHEL / Rocky / Alma 10 / 9 | systemctl list-units --type=service --state=running |
| Fedora 44 / 45 | systemctl list-units --type=service --state=running |
| Arch / Manjaro (rolling) | systemctl list-units --type=service --state=running |
| openSUSE Leap 16 / Tumbleweed / SLES | systemctl list-units --type=service --state=running |
| Alpine 3.23 / 3.24 | rc-status Shows services per runlevel and their state. |
Verschilt per distributieList services that failed.
First place to look after a reboot when something does not work.
Verschilt per distributie
| Debian 13 / 12 | systemctl --failed |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | systemctl --failed |
| RHEL / Rocky / Alma 10 / 9 | systemctl --failed |
| Fedora 44 / 45 | systemctl --failed |
| Arch / Manjaro (rolling) | systemctl --failed |
| openSUSE Leap 16 / Tumbleweed / SLES | systemctl --failed |
| Alpine 3.23 / 3.24 | rc-status --crashed Lists services that crashed. |
Verschilt per distributieFollow the logs of a service.
Verschilt per distributie
| Debian 13 / 12 | journalctl -u <service> -f |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | journalctl -u <service> -f |
| RHEL / Rocky / Alma 10 / 9 | journalctl -u <service> -f |
| Fedora 44 / 45 | journalctl -u <service> -f |
| Arch / Manjaro (rolling) | journalctl -u <service> -f |
| openSUSE Leap 16 / Tumbleweed / SLES | journalctl -u <service> -f |
| Alpine 3.23 / 3.24 | tail -f /var/log/messages Alpine uses a BusyBox syslog by default, not journald. Make sure syslog runs: rc-service syslog start and rc-update add syslog boot. |
Verschilt per distributieShow errors since the last boot.
Opties
-p err | Priority error and worse. |
|---|---|
-b | Only the current boot (-b -1 is the previous one). |
--since "1 hour ago" | Limit by time. |
-xe | Jump to the end with explanations. |
Verschilt per distributie
| Debian 13 / 12 | journalctl -p err -b |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | journalctl -p err -b |
| RHEL / Rocky / Alma 10 / 9 | journalctl -p err -b |
| Fedora 44 / 45 | journalctl -p err -b |
| Arch / Manjaro (rolling) | journalctl -p err -b |
| openSUSE Leap 16 / Tumbleweed / SLES | journalctl -p err -b |
| Alpine 3.23 / 3.24 | grep -iE "error|fail" /var/log/messages | tail -n 50 Alpine has no journal. This searches the BusyBox syslog file. |
Verschilt per distributieCheck mandatory access control (SELinux or AppArmor).
A service that fails with “permission denied” even though file permissions look right is often blocked by SELinux or AppArmor. Never disable it just to make a service start: fix the policy instead.
Verschilt per distributie
| Debian 13 / 12 | sudo aa-status AppArmor is enabled by default. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo aa-status AppArmor is enabled by default. |
| RHEL / Rocky / Alma 10 / 9 | getenforce SELinux, normally Enforcing. See recent denials with sudo ausearch -m avc -ts recent. |
| Fedora 44 / 45 | getenforce SELinux, normally Enforcing. See recent denials with sudo ausearch -m avc -ts recent. |
| openSUSE Leap 16 / Tumbleweed / SLES | getenforce Leap 16 uses SELinux (enforcing) by default. On Leap 15 and SLES 15 AppArmor is the default: use sudo aa-status. |
Verschilt per distributieCreate a user with a home directory.
Verschilt per distributie
| Debian 13 / 12 | sudo adduser <name> Interactive Debian wrapper that asks for a password and details. useradd -m <name> also works but does less. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo adduser <name> Interactive wrapper that asks for a password and details. |
| RHEL / Rocky / Alma 10 / 9 | sudo useradd -m <name> && sudo passwd <name> |
| Fedora 44 / 45 | sudo useradd -m <name> && sudo passwd <name> |
| Arch / Manjaro (rolling) | sudo useradd -m <name> && sudo passwd <name> Add -G wheel to give the user administrator rights right away. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo useradd -m <name> && sudo passwd <name> Leap 16 gives the new user a private primary group named after the user. |
| Alpine 3.23 / 3.24 | adduser <name> BusyBox adduser; asks for a password. Add the user to a group with adduser <name> <group>. |
Verschilt per distributieGive a user administrator (sudo) rights.
The user must log out and in again. The group needs a matching rule in /etc/sudoers (edit it only with visudo).
Verschilt per distributie
| Debian 13 / 12 | sudo usermod -aG sudo <name> If you set a root password during installation, sudo is not installed. Log in with su - and run the command without sudo, or install it first with apt install sudo. |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo usermod -aG sudo <name> |
| RHEL / Rocky / Alma 10 / 9 | sudo usermod -aG wheel <name> |
| Fedora 44 / 45 | sudo usermod -aG wheel <name> |
| Arch / Manjaro (rolling) | sudo usermod -aG wheel <name> Then run visudo and uncomment the %wheel ALL=(ALL:ALL) ALL line. |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo usermod -aG wheel <name> openSUSE may ask for the root password when you use sudo; adjust /etc/sudoers with visudo if you want your own password. |
| Alpine 3.23 / 3.24 | adduser <name> wheel Install sudo or doas first (apk add doas) and allow the wheel group, for doas in /etc/doas.d/doas.conf with the line: permit :wheel |
passwd <user>Set or change a password.
passwd <user>Set or change a password.Without a name you change your own password. As root you can set someone else’s.
Opties
-l <user> | Lock the account password. |
|---|---|
-u <user> | Unlock it again. |
Verschilt per distributieAdd a user to an extra group.
Verschilt per distributie
| Debian 13 / 12 | sudo usermod -aG <group> <user> |
|---|---|
| Ubuntu 26.04 / 24.04 LTS | sudo usermod -aG <group> <user> |
| RHEL / Rocky / Alma 10 / 9 | sudo usermod -aG <group> <user> |
| Fedora 44 / 45 | sudo usermod -aG <group> <user> |
| Arch / Manjaro (rolling) | sudo usermod -aG <group> <user> |
| openSUSE Leap 16 / Tumbleweed / SLES | sudo usermod -aG <group> <user> |
| Alpine 3.23 / 3.24 | adduser <user> <group> BusyBox has no usermod. The shadow package adds it if you need the GNU options. |
idShow the current user, UID and groups.
idShow the current user, UID and groups.Use id <user> to check someone else. Handy to verify that a group change took effect (it needs a new login).
De omschrijvingen in dit naslagwerk zijn voorlopig in het Engels.
Uitleg
Kies eerst je distributie: commando’s voor pakketten, services, firewall en netwerk verschillen tussen Debian, Ubuntu, RHEL en zijn klonen, Fedora, Arch, openSUSE en Alpine, en de pagina toont de actuele versies van elk. Elk commando heeft uitleg, een voorbeeld en de belangrijkste opties, met waarschuwingen waar het schade kan aanrichten. Controleer destructieve commando’s altijd twee keer voordat je ze uitvoert.
🔒 Je invoer blijft in je browser en wordt nergens naartoe gestuurd.
Veelgestelde vragen
Hoe zie ik welk proces een poort gebruikt?
Gebruik ss -tulpn of lsof -i :POORT.
Wat nu?
Een probleem gevonden of een suggestie? Laat het ons weten