Linux-Befehle-Spickzettel
NEULinux-Befehle-Spickzettel für das Terminal: Dateien, grep, find, Rechte, Prozesse, Festplatte, Netzwerk, tar, Benutzer und apt oder dnf. Mit Suchfilter und Kopieren per Klick. Die Befehle sind auf Englisch.
Läuft zu 100 % in deinem Browser — deine Eingaben werden nie hochgeladen oder auf unseren Servern gespeichert.
105 Einträge in 12 Abschnitten
Navigation
pwdPrint the current directory.
ls -lahList files with details, hidden files and human-readable sizes.
cd <dir>Change directory.
cd ~Go to your home directory.
cd -Go back to the previous directory.
cd ..Go up one directory.
Files & folders
touch <file>Create an empty file or update its modified time.
mkdir -p a/b/cCreate a folder and any missing parent folders.
cp <src> <dest>Copy a file.
cp -r <dir> <dest>Copy a folder with its contents.
mv <src> <dest>Move or rename a file or folder.
rm <file>Delete a file.
rm -r <dir>Delete a folder and everything in it. There is no trash, so double-check the path.
ln -s <target> <link>Create a symbolic link.
file <name>Show what type of file something is.
View & search
cat <file>Print a file.
less <file>Page through a file (q to quit, / to search).
head -n 20 <file>Show the first 20 lines.
tail -n 20 <file>Show the last 20 lines.
tail -f <file>Follow a file as new lines are added, handy for logs.
wc -l <file>Count lines in a file.
grep "text" <file>Print lines that contain text.
grep -rn "text" .Search recursively and show line numbers.
grep -i "text" <file>Search ignoring case.
find . -name "*.log"Find files by name under the current folder.
find . -type f -mtime -1Find files modified in the last 24 hours.
awk '{print $1}' <file>Print the first column of each line.
sed 's/old/new/g' <file>Replace text and print the result (the file is not changed).
sed -i 's/old/new/g' <file>Replace text in the file itself (GNU sed).
sort <file> | uniq -cCount how often each distinct line appears.
Permissions
Numbers: r=4, w=2, x=1, added per owner, group, others.
chmod 644 <file>Owner can read and write, everyone else can only read.
chmod 755 <file>Owner can read, write and run; others can read and run.
chmod +x <file>Make a file executable.
chmod u+rw,go-w <file>Symbolic form: add read/write for owner, remove write for group and others.
chown user:group <file>Change the owner and group of a file.
chown -R user:group <dir>Change owner and group recursively.
ls -lShow permissions as strings like -rwxr-xr-x.
Processes
ps auxList all running processes.
ps aux | grep <name>Find a process by name.
topLive view of processes and resource use.
htopFriendlier live process viewer (often needs to be installed).
kill <pid>Ask a process to stop (sends SIGTERM).
kill -9 <pid>Force a process to stop (SIGKILL). Use only if a normal kill fails.
pkill <name>Stop processes by name.
command &Run a command in the background.
jobsList background jobs of the current shell.
nohup <command> &Keep a command running after you close the terminal.
Disk
df -hShow free and used space for each mounted disk.
du -sh <dir>Show the total size of a folder.
du -sh * | sort -hSize of each item here, sorted from smallest to largest.
lsblkList disks and partitions.
mountShow mounted file systems.
free -hShow used and free memory.
Network
ping -c 4 <host>Send 4 echo requests to check a host is reachable.
curl -I <url>Fetch only the response headers of a URL.
curl -O <url>Download a file and keep its name.
wget <url>Download a file.
ip addrShow network interfaces and IP addresses.
ss -tulpnList listening TCP and UDP ports with the owning process (may need sudo).
dig <domain>Look up DNS records for a domain.
traceroute <host>Show the route packets take to a host.
ssh user@hostOpen a secure shell on a remote machine.
scp <file> user@host:/pathCopy a file to a remote machine over SSH.
Archive & compress
tar -czf archive.tar.gz <dir>Create a gzip-compressed tar archive.
tar -xzf archive.tar.gzExtract a .tar.gz archive here.
tar -xzf archive.tar.gz -C <dir>Extract into a specific folder.
tar -tf archive.tar.gzList the contents of an archive without extracting.
zip -r archive.zip <dir>Create a zip file from a folder.
unzip archive.zipExtract a zip file.
gzip <file>Compress a file to file.gz (the original is replaced).
Users & sudo
whoamiPrint your user name.
idShow your user id and groups.
sudo <command>Run a command as the administrator (root).
su - <user>Switch to another user with their environment.
sudo adduser <name>Create a user (Debian and Ubuntu).
sudo usermod -aG <group> <user>Add a user to a group without removing existing groups.
passwdChange your password.
System info
uname -aShow kernel and system information.
cat /etc/os-releaseShow the Linux distribution name and version.
uptimeShow how long the system has been running and the load.
datePrint the current date and time.
lscpuShow CPU details.
envList environment variables.
historyList commands you ran before.
man <command>Open the manual page of a command.
Package managers
sudo apt updateRefresh the package list (Debian, Ubuntu).
sudo apt upgradeInstall available updates (Debian, Ubuntu).
sudo apt install <package>Install a package with apt.
sudo apt remove <package>Remove a package with apt.
apt search <term>Search packages with apt.
sudo dnf install <package>Install a package with dnf (Fedora, RHEL, Rocky, Alma).
sudo dnf remove <package>Remove a package with dnf.
sudo dnf upgradeUpdate all packages with dnf.
dnf search <term>Search packages with dnf.
Pipes & redirection
cmd1 | cmd2Send the output of cmd1 into cmd2.
cmd > fileWrite output to a file, replacing it.
cmd >> fileAppend output to a file.
cmd < fileRead input from a file.
cmd 2> errors.txtWrite only error messages to a file.
cmd > out.txt 2>&1Write both normal output and errors to one file.
cmd > /dev/null 2>&1Throw away all output.
cmd1 && cmd2Run cmd2 only if cmd1 succeeded.
cmd1 || cmd2Run cmd2 only if cmd1 failed.
cmd | tee fileShow output and save it to a file at the same time.
xargsTurn input lines into arguments, e.g. find . -name "*.tmp" | xargs rm.
Schnelle Beispiele
Typische Eingaben und die Ergebnisse, die dieses Tool liefert.
Überblick
Die Linux-Kommandozeile ist mächtig, aber die richtigen Optionen vergisst man leicht. Dieser Linux-Befehle-Spickzettel listet die Alltagsbefehle für Navigation, Dateien, Anzeigen und Durchsuchen von Text mit grep, find, awk und sed, Rechte, Prozesse, Festplatte, Netzwerk, Archive, Benutzer und Systeminformationen auf.
Er behandelt außerdem die Paketmanager apt und dnf sowie die Pipe- und Umleitungsoperatoren, mit denen du Befehle verketten kannst. Befehle, die Daten löschen, etwa rm -r und kill -9, werden klar beschrieben, damit du vor dem Ausführen weißt, was sie tun.
Befehle, Optionen und ihre kurzen Beschreibungen werden auf Englisch angezeigt, wie im Terminal; übersetzt sind nur die Oberfläche und der Seitentext. Grenze die Liste mit dem Filter ein, kopiere einen Befehl und ersetze Platzhalter wie <file>. Alles läuft in deinem Browser und nichts, was du eingibst, wird irgendwohin gesendet.
Warum dieses Tool?
- Die richtigen Optionen in Sekunden finden
- Deckt Dateien, Netzwerk, Festplatte und Prozesse ab
- apt und dnf nebeneinander
- Einfache Erklärungen ohne Fachchinesisch
- Jeden Befehl mit einem Klick kopieren
Funktionen
Dateien und Navigation
ls, cd, cp, mv, rm, ln und mkdir -p mit gängigen Optionen.
Suche und Text
grep, find, awk, sed, sort und uniq, um mit Ausgaben zu arbeiten.
Rechte
chmod-Zahlen und symbolische Formen sowie chown.
Netzwerkwerkzeuge
curl, wget, ip, ss, dig, ssh und scp.
apt und dnf
Pakete in beiden Familien installieren, entfernen, aktualisieren und suchen.
Pipes und Umleitung
Operatoren wie |, >, >>, 2>&1, && und tee.
So funktioniert’s
Abschnitt wählen
Scrolle zu Files, Processes, Network oder dem gewünschten Thema (die Abschnittstitel sind auf Englisch).
Oder filtern
Tippe ein Wort wie „port“ oder „tar“ in das Feld „Diesen Spickzettel filtern“.
Lesen, was er tut
Lies die einzeilige Beschreibung auf Englisch, besonders bei Befehlen, die Daten löschen.
Kopieren und anpassen
Klicke auf Kopieren, füge den Befehl im Terminal ein und ersetze Platzhalter wie <file>.