Hoja de referencia de comandos Linux

Lista con búsqueda de los comandos Linux esenciales para archivos, permisos, texto, procesos, servicios, red y usuarios.

Se ejecuta en tu navegador · no se envía nada

Los comandos de paquetes, servicios, cortafuegos y red cambian según la distribución. Elige la tuya para ver el comando correcto.

89 comandos

ls -lahList files with details, hidden files and readable sizes.

Shows permissions, owner, size and modification time per file.

Opciones

-lLong format.
-aInclude hidden files (starting with a dot).
-hHuman-readable sizes (K, M, G).
-tNewest first.
-RRecurse into subfolders.
cd -Go back to the previous directory.

cd alone goes to your home folder. cd .. goes one level up.

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.

Opciones

-aArchive: recursive and preserves attributes.
-rRecursive (folders).
-iAsk before overwriting.
-vShow what is copied.
mv <src> <dst>Move or rename files and folders.

Moving within the same filesystem is instant; across filesystems it copies and then deletes.

Opciones

-iAsk before overwriting.
-nNever overwrite.
rm -rf <path>Delete files or folders recursively without asking.

Opciones

-rRecursive (needed for folders).
-fForce: no questions, ignore missing files.
-iAsk for each file.
Cuidado: There is no recycle bin. A typo, a stray space or an empty variable (rm -rf $DIR/) can wipe the wrong data. Run ls on the path first.
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.

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.

The first argument is where the link points to; the second is the new link name.

Ejemplo

ln -s /var/www/site /home/me/site
find <path> -name "*.log" -mtime -1Find files by name, type, size or age.

Ejemplo

find /var/log -type f -name "*.log" -size +100M

Opciones

-name "<pattern>"Match the file name (case-sensitive; -iname ignores case).
-type f|dOnly files or only directories.
-mtime -1Modified in the last day (+7 means older than 7 days).
-size +100MLarger than 100 MB.
-exec <cmd> {} \;Run a command on each match.
du -sh *Show how much space each item in the current folder uses.

Ejemplo

du -h -d 1 /var | sort -h

Opciones

-sSummary per argument.
-hHuman-readable sizes.
-d 1Only one level deep. Works with GNU and BusyBox; the long form --max-depth=1 is GNU only.

Notas por distribución

Alpine 3.23 / 3.24BusyBox du understands -d N but not --max-depth.
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.

Opciones

cCreate.
zCompress with gzip.
vVerbose: list files.
fArchive file name (must come last in the option group).
tar -xzvf archive.tar.gzExtract a gzip-compressed archive.

Ejemplo

tar -xzvf archive.tar.gz -C /opt/app

Opciones

xExtract.
-C <dir>Extract into this directory.
-tList contents without extracting.
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.

Ejemplo

chmod u+x script.sh

Opciones

-RApply recursively.
u+xSymbolic: add execute for the owner.
Cuidado: Avoid chmod -R 777. It makes everything writable for everybody.

Abrir Calculadora chmod →

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".

Ejemplo

chown -R www-data:www-data /var/www/site

Opciones

-RApply recursively.
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.

Abrir Calculadora de umask →

Notas por distribución

openSUSE Leap 16 / Tumbleweed / SLESOn 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.
Varía según la distribuciónOpen a root shell.

Prefer running single commands with sudo <cmd> so you do not stay root by accident.

Varía según la distribución

Debian 13 / 12sudo -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 LTSsudo -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 / 9sudo -i
Fedora 44 / 45sudo -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 / SLESsudo -i
Alpine 3.23 / 3.24su -
Alpine has no sudo by default. Run as root (su -), or install doas or sudo. The dash loads root’s environment.
Varía según la distribuciónRepeat the previous command with sudo.

Handy after “permission denied”. This is bash history expansion, so it works in bash and zsh.

Varía según la distribución

Debian 13 / 12sudo !!
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 LTSsudo !!
RHEL / Rocky / Alma 10 / 9sudo !!
Fedora 44 / 45sudo !!
Arch / Manjaro (rolling)sudo !!
Needs sudo to be installed and bash or zsh as your shell.
openSUSE Leap 16 / Tumbleweed / SLESsudo !!
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.

Opciones

/textSearch forward (n = next match).
G / gJump to the end / start.
qQuit.
FFollow new lines like tail -f (Ctrl+C to stop).
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.

Opciones

-n 100Start with the last 100 lines.
-FKeep following when the file is rotated.

Notas por distribución

Debian 13 / 12Debian 12 and newer do not install rsyslog by default, so /var/log/syslog may not exist. Use journalctl -f.
Fedora 44 / 45Fedora 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 / SLESCurrent openSUSE releases usually log only to the journal. Use journalctl -f.
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.

Opciones

-n <num>Number of lines.
-c <num>Number of bytes.
grep -rni "text" .Search for text in files, recursively and case-insensitive.

Ejemplo

grep -rn --include="*.conf" "ssl" /etc

Opciones

-rRecursive.
-nShow line numbers.
-iIgnore case.
-vInvert: lines that do not match.
-EExtended regular expressions.
-C 3Show 3 lines of context around each match.
sed -i "s/old/new/g" <file>Replace text in a file in place.

Opciones

-iEdit the file directly. Use -i.bak to keep a backup.
s/a/b/gSubstitute a with b everywhere on each line.
Cuidado: Test without -i first to see the result, or use -i.bak.
awk '{print $1}' <file>Print the first column of each line.

Ejemplo

awk -F: '{print $1}' /etc/passwd

Opciones

-F:Use : as the field separator.

Notas por distribución

Debian 13 / 12Debian ships mawk as the default awk. Basic scripts work, but GNU extensions need gawk (apt install gawk).
Ubuntu 26.04 / 24.04 LTSUbuntu ships mawk as the default awk. GNU extensions such as gensub need gawk (apt install gawk).
Alpine 3.23 / 3.24Alpine uses BusyBox awk. For GNU awk features install gawk.
sort | uniq -c | sort -nrCount identical lines and rank them.

Classic way to find the most frequent IP addresses or errors in a log.

Ejemplo

awk '{print $1}' access.log | sort | uniq -c | sort -nr | head
wc -l <file>Count lines.

Without a file name it counts what you pipe in, for example ls | wc -l.

Opciones

-wWords.
-cBytes.
cut -d: -f1 /etc/passwdPick a column from delimited text.

Opciones

-d:Delimiter.
-f1,3Fields to keep.
xargsTurn lines of input into arguments for another command.

Ejemplo

find . -name "*.tmp" | xargs rm

Opciones

-n 1One argument per command run.
-0Input is NUL-separated (use with find -print0).
Cuidado: Names with spaces break the simple form. Use find ... -print0 | xargs -0 ... for safe handling.
ps auxList all running processes.

Columns include user, PID, CPU and memory usage and the command.

Ejemplo

ps aux | grep nginx

Notas por distribución

Alpine 3.23 / 3.24BusyBox 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.

Opciones

qQuit.
M / PSort by memory / CPU (in top).
kKill a process (in top).

Notas por distribución

Debian 13 / 12htop is not installed by default: apt install htop.
RHEL / Rocky / Alma 10 / 9htop 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.24BusyBox top is limited. Install htop with apk add htop.
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.

Opciones

-15TERM: polite request (default).
-9KILL: immediate, no cleanup.
-HUPOften makes daemons reload their config.
Cuidado: kill -9 can leave temporary files and corrupt data. Use it as a last resort.
pkill <name>Stop processes by name.

Matches part of the process name, so check with pgrep -l <name> first.

Opciones

-fMatch against the full command line.
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.

Replaces the old ifconfig, which is not installed on many modern systems.

Opciones

-br aBrief, one line per interface.

Notas por distribución

Alpine 3.23 / 3.24The 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.

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.

Needs root (sudo) to show the process names.

Opciones

-t / -uTCP / UDP.
-lListening sockets only.
-pShow the process.
-nNumeric ports, no name lookups.

Abrir Puertos de red habituales →

Notas por distribución

Alpine 3.23 / 3.24ss 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.

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.

Alternatives: tracepath, or mtr for a live view.

Notas por distribución

Debian 13 / 12Not installed by default: apt install traceroute.
Ubuntu 26.04 / 24.04 LTSNot installed by default: apt install traceroute.
RHEL / Rocky / Alma 10 / 9Not installed by default: dnf install traceroute.
Fedora 44 / 45Not installed by default: dnf install traceroute.
Arch / Manjaro (rolling)Not installed by default: pacman -S traceroute.
Alpine 3.23 / 3.24BusyBox includes a basic traceroute applet.
dig <domain> +shortLook up DNS records.

Ejemplo

dig MX example.com +short

Opciones

@8.8.8.8Ask a specific DNS server.
+shortOnly the answer.
-x <ip>Reverse lookup.

Notas por distribución

Debian 13 / 12Not installed by default. The package is bind9-dnsutils. On Debian 13 the old name dnsutils may no longer work.
Ubuntu 26.04 / 24.04 LTSNot installed on minimal installs. The package is bind9-dnsutils.
RHEL / Rocky / Alma 10 / 9Not installed on minimal installs. The package is bind-utils.
Fedora 44 / 45Not 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 / SLESNot installed on minimal installs. The package is bind-utils.
Alpine 3.23 / 3.24Not installed by default. The package is bind-tools: apk add bind-tools.
curl -I <url>Fetch only the HTTP response headers.

Opciones

-LFollow redirects.
-vVerbose: show the whole exchange.
-kSkip certificate checks (testing only).

Notas por distribución

Alpine 3.23 / 3.24curl is not installed by default (BusyBox has wget): apk add curl.
curl -fsSL <url> | bashDownload a script and run it immediately.
Cuidado: Runs code you have not read, often as your user or root. Download first, read it, then run it, and only for sources you trust.
wget -c <url>Download a file and resume if interrupted.

Saves to the current folder. Good for large downloads on unreliable connections.

Opciones

-cContinue a partial download.
-O <name>Choose the output file name.
-qQuiet.
-rDownload recursively (mirror a site).

Notas por distribución

Alpine 3.23 / 3.24The 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.

Opciones

-p 2222Use another port.
-i ~/.ssh/keyUse a specific private key.
-L 8080:localhost:80Forward a local port through the connection.

Notas por distribución

openSUSE Leap 16 / Tumbleweed / SLESopenSUSE 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.24The ssh client is not installed by default: apk add openssh-client.
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.

Opciones

-rCopy folders.
-P 2222Port (capital P).

Notas por distribución

Alpine 3.23 / 3.24Part of the openssh-client packages: apk add openssh-client.
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.

Opciones

-aArchive: recursive, keeps permissions and times.
-vVerbose.
-zCompress during transfer.
-nDry run: show what would happen.
--deleteRemove files on the target that no longer exist on the source.
Cuidado: --delete can erase data on the destination. Combine with -n first.

Notas por distribución

Alpine 3.23 / 3.24Not installed by default: apk add rsync.
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.

Ejemplo

timeout 3 bash -c '</dev/tcp/example.com/443' && echo open || echo closed

Notas por distribución

Debian 13 / 12Install netcat-openbsd.
Ubuntu 26.04 / 24.04 LTSInstall netcat-openbsd.
RHEL / Rocky / Alma 10 / 9Install nmap-ncat.
Fedora 44 / 45Install nmap-ncat.
Arch / Manjaro (rolling)Install openbsd-netcat.
openSUSE Leap 16 / Tumbleweed / SLESInstall netcat-openbsd.
Alpine 3.23 / 3.24The built-in BusyBox nc has fewer options. For the full version install netcat-openbsd. The bash example needs bash (apk add bash).
Varía según la distribuciónFind 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.

Notas por distribución

Debian 13 / 12Server installs often use ifupdown (the networking service), desktop installs NetworkManager, and cloud images netplan with systemd-networkd.
Ubuntu 26.04 / 24.04 LTSUbuntu uses netplan as the front-end. It drives systemd-networkd on servers and NetworkManager on desktops.
RHEL / Rocky / Alma 10 / 9RHEL and its clones use NetworkManager. RHEL 10 removed the old ifcfg-style files; connection profiles are NetworkManager keyfiles.
Fedora 44 / 45Fedora uses NetworkManager.
openSUSE Leap 16 / Tumbleweed / SLESopenSUSE Leap 16 uses NetworkManager only; wicked is gone. Leap 15 and SLES 15 servers can still use wicked.

Varía según la distribución

Debian 13 / 12systemctl is-active NetworkManager systemd-networkd networking
Ubuntu 26.04 / 24.04 LTSsystemctl is-active NetworkManager systemd-networkd networking
RHEL / Rocky / Alma 10 / 9systemctl is-active NetworkManager systemd-networkd networking
Fedora 44 / 45systemctl is-active NetworkManager systemd-networkd networking
Arch / Manjaro (rolling)systemctl is-active NetworkManager systemd-networkd networking
openSUSE Leap 16 / Tumbleweed / SLESsystemctl is-active NetworkManager systemd-networkd networking
Alpine 3.23 / 3.24rc-service networking status
Alpine configures the network in /etc/network/interfaces.
Varía según la distribuciónApply a changed network configuration.

Which command applies when you use depends on the tool found with the previous entry.

Cuidado: Applying a faulty network configuration over SSH can lock you out of the machine. Keep a console open, or use a command that rolls back on its own where one exists (netplan try).

Varía según la distribución

Debian 13 / 12sudo 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 LTSsudo 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 / 9sudo 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 / 45sudo 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 / SLESsudo 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.24rc-service networking restart
Edit /etc/network/interfaces first. Restarting over SSH drops the connection while it runs.
Varía según la distribuciónShow 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.

Varía según la distribución

Debian 13 / 12sudo 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 LTSsudo ufw status verbose
ufw is installed but inactive until you enable it.
RHEL / Rocky / Alma 10 / 9sudo firewall-cmd --list-all
firewalld is enabled by default. Check it runs with systemctl is-active firewalld.
Fedora 44 / 45sudo 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 / SLESsudo 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.24nft list ruleset
No firewall by default. Install nftables or iptables first (apk add nftables).
Varía según la distribuciónOpen TCP port 443 in the firewall.
Cuidado: Check you are not locking yourself out of SSH before enabling or changing a firewall on a remote server. Allow SSH first.

Varía según la distribución

Debian 13 / 12sudo 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 LTSsudo ufw allow 443/tcp
Allow SSH first (sudo ufw allow OpenSSH) before running sudo ufw enable.
RHEL / Rocky / Alma 10 / 9sudo 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 / 45sudo 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 / SLESsudo firewall-cmd --permanent --add-service=https && sudo firewall-cmd --reload
Alpine 3.23 / 3.24iptables -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.

For the distribution name and version use cat /etc/os-release instead.

Opciones

-rKernel release only.
-mArchitecture, for example x86_64 or aarch64.
-nHostname.
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.

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.

Look at the “available” column rather than “free”: Linux uses spare memory for caching.

lsblkList disks and partitions as a tree.

Opciones

-fShow filesystem type, label and UUID.

Notas por distribución

Alpine 3.23 / 3.24lsblk 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?

Also useful to see which process keeps a deleted file open: lsof +L1.

Notas por distribución

Alpine 3.23 / 3.24BusyBox has only a minimal lsof. Install the real one with apk add lsof.
Varía según la distribuciónKernel 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.

Varía según la distribución

Debian 13 / 12sudo 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 LTSsudo dmesg -T | tail
RHEL / Rocky / Alma 10 / 9sudo dmesg -T | tail
Fedora 44 / 45sudo dmesg -T | tail
Arch / Manjaro (rolling)sudo dmesg -T | tail
openSUSE Leap 16 / Tumbleweed / SLESsudo dmesg -T | tail
Alpine 3.23 / 3.24dmesg | 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.

Format: minute hour day month weekday command. See the cron explainer on this site.

Opciones

-lList your jobs.

Abrir Explicador de cron →

Notas por distribución

RHEL / Rocky / Alma 10 / 9The cron daemon is the cronie package. Check that crond runs: systemctl status crond.
Fedora 44 / 45The 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 / SLESInstall cron if it is missing. systemd timers are the alternative.
Alpine 3.23 / 3.24BusyBox crond is not started by default: rc-update add crond default and rc-service crond start.
history | grep <text>Search your command history.

Press Ctrl+R in the shell for interactive reverse search.

Varía según la distribuciónSet the time zone.

List valid names with timedatectl list-timezones on systemd systems. Check the result with date.

Varía según la distribución

Debian 13 / 12sudo timedatectl set-timezone Europe/Amsterdam
Ubuntu 26.04 / 24.04 LTSsudo timedatectl set-timezone Europe/Amsterdam
RHEL / Rocky / Alma 10 / 9sudo timedatectl set-timezone Europe/Amsterdam
Fedora 44 / 45sudo timedatectl set-timezone Europe/Amsterdam
Arch / Manjaro (rolling)sudo timedatectl set-timezone Europe/Amsterdam
openSUSE Leap 16 / Tumbleweed / SLESsudo timedatectl set-timezone Europe/Amsterdam
Alpine 3.23 / 3.24setup-timezone -z Europe/Amsterdam
Needs the tzdata package: apk add tzdata. Alpine has no systemd, so no timedatectl.
Varía según la distribuciónDoes the system need a reboot after updates?

A reboot is needed after kernel, glibc/libc or systemd updates. Services can often be restarted instead.

Varía según la distribución

Debian 13 / 12sudo 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 LTScat /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 / 9sudo 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 / 45sudo 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 / SLESsudo zypper needs-rebooting
sudo zypper ps -s lists processes that use deleted files and need a restart.
Varía según la distribuciónRefresh the list of available packages.

Downloads the latest package information from the repositories. Does not install anything on most systems.

Varía según la distribución

Debian 13 / 12sudo 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 LTSsudo apt update
RHEL / Rocky / Alma 10 / 9sudo 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 / 45sudo 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 / SLESsudo zypper refresh
Leap 16 has no separate update repository any more; the main repositories carry updates as well.
Alpine 3.23 / 3.24apk update
Run as root. Alpine has no sudo by default. Run as root (su -), or install doas or sudo.
Varía según la distribuciónUpgrade all installed packages.

Review what will change before confirming. Reboot afterwards if the kernel or core libraries were updated.

Varía según la distribución

Debian 13 / 12sudo 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 LTSsudo 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 / 9sudo dnf upgrade
Add --security to install only security updates. update is a synonym of upgrade.
Fedora 44 / 45sudo 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 / SLESsudo 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.24apk 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.
Varía según la distribuciónInstall a package.

Replace <pkg> with the package name, for example nginx. Several packages can be listed at once.

Varía según la distribución

Debian 13 / 12sudo apt install <pkg>
Ubuntu 26.04 / 24.04 LTSsudo apt install <pkg>
RHEL / Rocky / Alma 10 / 9sudo 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 / 45sudo 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 / SLESsudo zypper install <pkg>
Short form: zypper in <pkg>.
Alpine 3.23 / 3.24apk add <pkg>
In Dockerfiles use apk add --no-cache <pkg> so no package index stays in the image.
Varía según la distribuciónRemove a package.

Removing may leave configuration files behind. Some systems have a purge option that removes those too.

Varía según la distribución

Debian 13 / 12sudo 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 LTSsudo apt remove <pkg>
sudo apt purge <pkg> also deletes its configuration files.
RHEL / Rocky / Alma 10 / 9sudo dnf remove <pkg>
Dependencies pulled in only for this package are removed too (default behaviour).
Fedora 44 / 45sudo 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 / SLESsudo zypper remove <pkg>
Short form: zypper rm <pkg>.
Alpine 3.23 / 3.24apk del <pkg>
Also removes dependencies that became orphans. Configuration files you edited are kept.
Varía según la distribuciónShow details about a package (version, size, dependencies).

Varía según la distribución

Debian 13 / 12apt show <pkg>
Ubuntu 26.04 / 24.04 LTSapt show <pkg>
RHEL / Rocky / Alma 10 / 9dnf info <pkg>
Fedora 44 / 45dnf info <pkg>
Arch / Manjaro (rolling)pacman -Si <pkg>
Use pacman -Qi for a package that is already installed.
openSUSE Leap 16 / Tumbleweed / SLESzypper info <pkg>
Alpine 3.23 / 3.24apk info -a <pkg>
Without -a only the description is shown.
Varía según la distribuciónList installed packages.

Pipe to grep to check for one package, for example the Debian command followed by | grep nginx.

Varía según la distribución

Debian 13 / 12apt list --installed
Ubuntu 26.04 / 24.04 LTSapt list --installed
RHEL / Rocky / Alma 10 / 9dnf list --installed
Fedora 44 / 45dnf list --installed
Arch / Manjaro (rolling)pacman -Q
openSUSE Leap 16 / Tumbleweed / SLESzypper search --installed-only
Alpine 3.23 / 3.24apk list --installed
Varía según la distribuciónWhich 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.

Varía según la distribución

Debian 13 / 12dpkg -S /path/to/file
Ubuntu 26.04 / 24.04 LTSdpkg -S /path/to/file
RHEL / Rocky / Alma 10 / 9rpm -qf /path/to/file
Fedora 44 / 45rpm -qf /path/to/file
Arch / Manjaro (rolling)pacman -Qo /path/to/file
openSUSE Leap 16 / Tumbleweed / SLESrpm -qf /path/to/file
Alpine 3.23 / 3.24apk info -W /path/to/file
Varía según la distribuciónWhich package provides a command that is not installed?

Useful after “command not found”: find the package, then install it.

Varía según la distribución

Debian 13 / 12apt-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 LTSapt-file search bin/dig
Install the tool and its index first: sudo apt install apt-file && sudo apt-file update.
RHEL / Rocky / Alma 10 / 9dnf provides "*/bin/dig"
Fedora 44 / 45dnf provides "*/bin/dig"
Arch / Manjaro (rolling)pacman -F dig
Download the file database first: sudo pacman -Fy.
openSUSE Leap 16 / Tumbleweed / SLESzypper 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.24apk 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.
Varía según la distribuciónList the files installed by a package.

Shows where a package put its binaries, configuration and documentation. Handy for finding a program’s config file.

Varía según la distribución

Debian 13 / 12dpkg -L <pkg>
Ubuntu 26.04 / 24.04 LTSdpkg -L <pkg>
RHEL / Rocky / Alma 10 / 9rpm -ql <pkg>
Fedora 44 / 45rpm -ql <pkg>
Arch / Manjaro (rolling)pacman -Ql <pkg>
openSUSE Leap 16 / Tumbleweed / SLESrpm -ql <pkg>
Alpine 3.23 / 3.24apk info -L <pkg>
Varía según la distribuciónInstall a package file you downloaded.
Cuidado: Only install packages from sources you trust and verify their signature or checksum.

Varía según la distribución

Debian 13 / 12sudo apt install ./file.deb
Resolves dependencies, unlike dpkg -i.
Ubuntu 26.04 / 24.04 LTSsudo apt install ./file.deb
Resolves dependencies, unlike dpkg -i.
RHEL / Rocky / Alma 10 / 9sudo dnf install ./file.rpm
Fedora 44 / 45sudo dnf install ./file.rpm
Arch / Manjaro (rolling)sudo pacman -U file.pkg.tar.zst
openSUSE Leap 16 / Tumbleweed / SLESsudo zypper install ./file.rpm
Varía según la distribuciónFree disk space: remove unused dependencies and cached downloads.

Varía según la distribución

Debian 13 / 12sudo apt autoremove && sudo apt clean
Ubuntu 26.04 / 24.04 LTSsudo apt autoremove && sudo apt clean
RHEL / Rocky / Alma 10 / 9sudo dnf autoremove && sudo dnf clean all
Fedora 44 / 45sudo 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 / SLESsudo zypper clean --all
Alpine 3.23 / 3.24apk cache clean
Only does something when package caching is set up (a /etc/apk/cache link). In containers use apk add --no-cache instead.
Varía según la distribuciónCheck 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.

Varía según la distribución

Debian 13 / 12systemctl status <service>
Ubuntu 26.04 / 24.04 LTSsystemctl status <service>
RHEL / Rocky / Alma 10 / 9systemctl status <service>
Fedora 44 / 45systemctl status <service>
Arch / Manjaro (rolling)systemctl status <service>
openSUSE Leap 16 / Tumbleweed / SLESsystemctl status <service>
Alpine 3.23 / 3.24rc-service <service> status
Alpine uses OpenRC instead of systemd. The SSH service is called sshd.
Varía según la distribuciónRestart a service.

Use reload instead of restart when the service supports it: no downtime.

Varía según la distribución

Debian 13 / 12sudo systemctl restart <service>
Ubuntu 26.04 / 24.04 LTSsudo systemctl restart <service>
RHEL / Rocky / Alma 10 / 9sudo systemctl restart <service>
Fedora 44 / 45sudo systemctl restart <service>
Arch / Manjaro (rolling)sudo systemctl restart <service>
openSUSE Leap 16 / Tumbleweed / SLESsudo systemctl restart <service>
Alpine 3.23 / 3.24rc-service <service> restart
Varía según la distribuciónStart 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>.

Varía según la distribución

Debian 13 / 12sudo systemctl enable --now <service>
Debian often starts a service right after installing its package.
Ubuntu 26.04 / 24.04 LTSsudo systemctl enable --now <service>
Ubuntu usually starts a service right after installing its package.
RHEL / Rocky / Alma 10 / 9sudo systemctl enable --now <service>
RHEL does not start services automatically after installation.
Fedora 44 / 45sudo systemctl enable --now <service>
Arch / Manjaro (rolling)sudo systemctl enable --now <service>
Arch does not start services automatically after installation.
openSUSE Leap 16 / Tumbleweed / SLESsudo systemctl enable --now <service>
Alpine 3.23 / 3.24rc-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.
Varía según la distribuciónList running services.

Varía según la distribución

Debian 13 / 12systemctl list-units --type=service --state=running
Ubuntu 26.04 / 24.04 LTSsystemctl list-units --type=service --state=running
RHEL / Rocky / Alma 10 / 9systemctl list-units --type=service --state=running
Fedora 44 / 45systemctl list-units --type=service --state=running
Arch / Manjaro (rolling)systemctl list-units --type=service --state=running
openSUSE Leap 16 / Tumbleweed / SLESsystemctl list-units --type=service --state=running
Alpine 3.23 / 3.24rc-status
Shows services per runlevel and their state.
Varía según la distribuciónList services that failed.

First place to look after a reboot when something does not work.

Varía según la distribución

Debian 13 / 12systemctl --failed
Ubuntu 26.04 / 24.04 LTSsystemctl --failed
RHEL / Rocky / Alma 10 / 9systemctl --failed
Fedora 44 / 45systemctl --failed
Arch / Manjaro (rolling)systemctl --failed
openSUSE Leap 16 / Tumbleweed / SLESsystemctl --failed
Alpine 3.23 / 3.24rc-status --crashed
Lists services that crashed.
Varía según la distribuciónFollow the logs of a service.

Varía según la distribución

Debian 13 / 12journalctl -u <service> -f
Ubuntu 26.04 / 24.04 LTSjournalctl -u <service> -f
RHEL / Rocky / Alma 10 / 9journalctl -u <service> -f
Fedora 44 / 45journalctl -u <service> -f
Arch / Manjaro (rolling)journalctl -u <service> -f
openSUSE Leap 16 / Tumbleweed / SLESjournalctl -u <service> -f
Alpine 3.23 / 3.24tail -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.
Varía según la distribuciónShow errors since the last boot.

Opciones

-p errPriority error and worse.
-bOnly the current boot (-b -1 is the previous one).
--since "1 hour ago"Limit by time.
-xeJump to the end with explanations.

Varía según la distribución

Debian 13 / 12journalctl -p err -b
Ubuntu 26.04 / 24.04 LTSjournalctl -p err -b
RHEL / Rocky / Alma 10 / 9journalctl -p err -b
Fedora 44 / 45journalctl -p err -b
Arch / Manjaro (rolling)journalctl -p err -b
openSUSE Leap 16 / Tumbleweed / SLESjournalctl -p err -b
Alpine 3.23 / 3.24grep -iE "error|fail" /var/log/messages | tail -n 50
Alpine has no journal. This searches the BusyBox syslog file.
Varía según la distribuciónCheck 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.

Varía según la distribución

Debian 13 / 12sudo aa-status
AppArmor is enabled by default.
Ubuntu 26.04 / 24.04 LTSsudo aa-status
AppArmor is enabled by default.
RHEL / Rocky / Alma 10 / 9getenforce
SELinux, normally Enforcing. See recent denials with sudo ausearch -m avc -ts recent.
Fedora 44 / 45getenforce
SELinux, normally Enforcing. See recent denials with sudo ausearch -m avc -ts recent.
openSUSE Leap 16 / Tumbleweed / SLESgetenforce
Leap 16 uses SELinux (enforcing) by default. On Leap 15 and SLES 15 AppArmor is the default: use sudo aa-status.
Varía según la distribuciónCreate a user with a home directory.

Varía según la distribución

Debian 13 / 12sudo 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 LTSsudo adduser <name>
Interactive wrapper that asks for a password and details.
RHEL / Rocky / Alma 10 / 9sudo useradd -m <name> && sudo passwd <name>
Fedora 44 / 45sudo 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 / SLESsudo useradd -m <name> && sudo passwd <name>
Leap 16 gives the new user a private primary group named after the user.
Alpine 3.23 / 3.24adduser <name>
BusyBox adduser; asks for a password. Add the user to a group with adduser <name> <group>.
Varía según la distribuciónGive 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).

Varía según la distribución

Debian 13 / 12sudo 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 LTSsudo usermod -aG sudo <name>
RHEL / Rocky / Alma 10 / 9sudo usermod -aG wheel <name>
Fedora 44 / 45sudo 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 / SLESsudo 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.24adduser <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.

Without a name you change your own password. As root you can set someone else’s.

Opciones

-l <user>Lock the account password.
-u <user>Unlock it again.
Varía según la distribuciónAdd a user to an extra group.
Cuidado: Do not forget -a. Without it the user is removed from all other supplementary groups.

Varía según la distribución

Debian 13 / 12sudo usermod -aG <group> <user>
Ubuntu 26.04 / 24.04 LTSsudo usermod -aG <group> <user>
RHEL / Rocky / Alma 10 / 9sudo usermod -aG <group> <user>
Fedora 44 / 45sudo usermod -aG <group> <user>
Arch / Manjaro (rolling)sudo usermod -aG <group> <user>
openSUSE Leap 16 / Tumbleweed / SLESsudo usermod -aG <group> <user>
Alpine 3.23 / 3.24adduser <user> <group>
BusyBox has no usermod. The shadow package adds it if you need the GNU options.
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).

Las descripciones de esta referencia están por ahora en inglés.

Explicación

Elige primero tu distribución: los comandos de paquetes, servicios, cortafuegos y red cambian entre Debian, Ubuntu, RHEL y sus clones, Fedora, Arch, openSUSE y Alpine, y la página muestra las versiones actuales de cada una. Cada comando incluye explicación, ejemplo y sus opciones principales, con avisos donde pueda causar daño. Revisa siempre dos veces los comandos destructivos antes de ejecutarlos.

🔒 Tu entrada se queda en tu navegador y no se envía a ningún sitio.

Preguntas frecuentes

¿Cómo veo qué proceso usa un puerto?

Usa ss -tulpn o lsof -i :PUERTO.

Qué hacer después

Más en esta sección

  • Hoja de referencia de GitLista con búsqueda de los comandos Git más útiles para configuración, ramas, remotos, deshacer cambios e inspeccionar el historial.

También útil

  • Calculadora chmodConvierte permisos de archivos Linux entre octal (755) y simbólico (rwxr-xr-x) con una matriz clicable.
  • Calculadora de umaskCalcula los permisos predeterminados de archivos y directorios nuevos en Linux a partir de un valor umask como 022 o 077.
  • Buscador de ID de eventos de WindowsConsulta ID de eventos habituales de Windows: sesiones, cuentas, servicios, Kerberos, RDP y PowerShell. Útil para diagnóstico y auditorías.

¿Has encontrado un problema o tienes una sugerencia? Cuéntanoslo