====== Welche Linux-Distribution verwende ich? ====== Es gibt verschiedene Methoden, um herauszufinden, welche Linux-Distribution und Version auf einem System installiert ist. Diese Seite zeigt die gängigsten Wege zur Identifikation. ===== Schnellübersicht ===== # Einfachste Methode - funktioniert auf allen modernen Distributionen cat /etc/os-release # Alternative mit hostnamectl (systemd-Systeme) hostnamectl # LSB-Informationen (falls installiert) lsb_release -a # Kernel-Version uname -a ===== Methode 1: /etc/os-release (Universal) ===== Die Datei ''/etc/os-release'' ist der moderne Standard und funktioniert auf nahezu allen aktuellen Distributionen. ==== Syntax ==== cat /etc/os-release ==== Beispiele für verschiedene Distributionen ==== === Debian === cat /etc/os-release PRETTY_NAME="Debian GNU/Linux 12 (bookworm)" NAME="Debian GNU/Linux" VERSION_ID="12" VERSION="12 (bookworm)" VERSION_CODENAME=bookworm ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/" === Ubuntu / Linux Mint === **Ubuntu:** PRETTY_NAME="Ubuntu 22.04.3 LTS" NAME="Ubuntu" VERSION_ID="22.04" VERSION="22.04.3 LTS (Jammy Jellyfish)" VERSION_CODENAME=jammy ID=ubuntu ID_LIKE=debian HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" **Linux Mint:** NAME="Linux Mint" VERSION="21.2 (Victoria)" ID=linuxmint ID_LIKE=ubuntu PRETTY_NAME="Linux Mint 21.2" VERSION_ID="21.2" HOME_URL="https://www.linuxmint.com/" SUPPORT_URL="https://forums.linuxmint.com/" BUG_REPORT_URL="http://linuxmint-troubleshooting-guide.readthedocs.io/en/latest/" VERSION_CODENAME=victoria UBUNTU_CODENAME=jammy === Fedora === NAME="Fedora Linux" VERSION="39 (Workstation Edition)" ID=fedora VERSION_ID=39 VERSION_CODENAME="" PLATFORM_ID="platform:f39" PRETTY_NAME="Fedora Linux 39 (Workstation Edition)" LOGO=fedora-logo-icon CPE_NAME="cpe:/o:fedoraproject:fedora:39" HOME_URL="https://fedoraproject.org/" DOCUMENTATION_URL="https://docs.fedoraproject.org/en-US/fedora/f39/system-administrators-guide/" SUPPORT_URL="https://ask.fedoraproject.org/" BUG_REPORT_URL="https://bugzilla.redhat.com/" REDHAT_BUGZILLA_PRODUCT="Fedora" === openSUSE / SUSE Linux Enterprise === **openSUSE Leap:** NAME="openSUSE Leap" VERSION="15.5" ID="opensuse-leap" ID_LIKE="suse opensuse" VERSION_ID="15.5" PRETTY_NAME="openSUSE Leap 15.5" CPE_NAME="cpe:/o:opensuse:leap:15.5" BUG_REPORT_URL="https://bugs.opensuse.org" HOME_URL="https://www.opensuse.org/" **openSUSE Tumbleweed:** NAME="openSUSE Tumbleweed" ID="opensuse-tumbleweed" ID_LIKE="opensuse suse" VERSION_ID="20231224" PRETTY_NAME="openSUSE Tumbleweed" CPE_NAME="cpe:/o:opensuse:tumbleweed:20231224" BUG_REPORT_URL="https://bugzilla.opensuse.org" HOME_URL="https://www.opensuse.org/" **SUSE Linux Enterprise Server:** NAME="SLES" VERSION="15-SP5" VERSION_ID="15.5" PRETTY_NAME="SUSE Linux Enterprise Server 15 SP5" ID="sles" ID_LIKE="suse" CPE_NAME="cpe:/o:suse:sles:15:sp5" ==== Einzelne Werte auslesen ==== # Nur den Namen anzeigen grep ^NAME= /etc/os-release grep ^PRETTY_NAME= /etc/os-release # Wert extrahieren (ohne Anführungszeichen) source /etc/os-release && echo $NAME source /etc/os-release && echo $VERSION_ID # Mit sed sed -n 's/^PRETTY_NAME="\(.*\)"/\1/p' /etc/os-release ===== Methode 2: hostnamectl (systemd) ===== Auf Systemen mit systemd liefert ''hostnamectl'' übersichtliche Systeminformationen. ==== Syntax ==== hostnamectl ==== Beispiel-Ausgabe ==== === Debian === Static hostname: debian-server Icon name: computer-vm Chassis: vm Machine ID: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 Boot ID: 1234567890abcdef1234567890abcdef Virtualization: kvm Operating System: Debian GNU/Linux 12 (bookworm) Kernel: Linux 6.1.0-13-amd64 Architecture: x86-64 === Ubuntu === Static hostname: ubuntu-desktop Icon name: computer-laptop Chassis: laptop Machine ID: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 Boot ID: 1234567890abcdef1234567890abcdef Operating System: Ubuntu 22.04.3 LTS Kernel: Linux 5.15.0-91-generic Architecture: x86-64 Hardware Vendor: Dell Inc. Hardware Model: XPS 15 9520 === Fedora === Static hostname: fedora-workstation Icon name: computer-laptop Chassis: laptop Machine ID: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 Boot ID: 1234567890abcdef1234567890abcdef Operating System: Fedora Linux 39 (Workstation Edition) CPE OS Name: cpe:/o:fedoraproject:fedora:39 Kernel: Linux 6.6.7-200.fc39.x86_64 Architecture: x86-64 Hardware Vendor: Lenovo Hardware Model: ThinkPad T14 Gen 3 === openSUSE === Static hostname: opensuse-leap Icon name: computer-desktop Chassis: desktop Machine ID: a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6 Boot ID: 1234567890abcdef1234567890abcdef Operating System: openSUSE Leap 15.5 CPE OS Name: cpe:/o:opensuse:leap:15.5 Kernel: Linux 5.14.21-150500.55.39-default Architecture: x86-64 ===== Methode 3: lsb_release ===== Das ''lsb_release''-Kommando zeigt LSB (Linux Standard Base) Informationen an. Muss oft erst installiert werden. ==== Installation ==== # Debian / Ubuntu / Linux Mint sudo apt install lsb-release # Fedora sudo dnf install redhat-lsb-core # openSUSE / SUSE sudo zypper install lsb-release ==== Syntax ==== lsb_release -a # Alle Informationen lsb_release -d # Nur Beschreibung lsb_release -i # Nur Distributor ID lsb_release -r # Nur Release-Nummer lsb_release -c # Nur Codename ==== Beispiel-Ausgaben ==== === Debian === No LSB modules are available. Distributor ID: Debian Description: Debian GNU/Linux 12 (bookworm) Release: 12 Codename: bookworm === Ubuntu === Distributor ID: Ubuntu Description: Ubuntu 22.04.3 LTS Release: 22.04 Codename: jammy === Linux Mint === Distributor ID: Linuxmint Description: Linux Mint 21.2 Victoria Release: 21.2 Codename: victoria === Fedora === LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: Fedora Description: Fedora release 39 (Thirty Nine) Release: 39 Codename: ThirtyNine ===== Methode 4: Distributionsspezifische Dateien ===== Ältere Methode - verschiedene Distributionen nutzen unterschiedliche Dateien. ==== Alle Release-Dateien anzeigen ==== cat /etc/*release # oder cat /etc/*-release # Liste aller Release-Dateien ls -la /etc/*release /etc/*-release /etc/*_version 2>/dev/null ==== Distributionsspezifische Dateien ==== ^ Distribution ^ Datei ^ Inhalt ^ | Debian | ''/etc/debian_version'' | ''12.4'' | | Ubuntu | ''/etc/lsb-release'' | LSB-Informationen | | Fedora | ''/etc/fedora-release'' | ''Fedora release 39 (Thirty Nine)'' | | Red Hat | ''/etc/redhat-release'' | ''Red Hat Enterprise Linux release 9.3'' | | SUSE | ''/etc/SuSE-release'' | Veraltet, nutze /etc/os-release | | openSUSE | ''/etc/os-release'' | Standard-Datei | ==== Beispiele ==== === Debian === cat /etc/debian_version # Ausgabe: 12.4 === Ubuntu (lsb-release) === cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=22.04 DISTRIB_CODENAME=jammy DISTRIB_DESCRIPTION="Ubuntu 22.04.3 LTS" === Fedora === cat /etc/fedora-release # Ausgabe: Fedora release 39 (Thirty Nine) cat /etc/redhat-release # Ausgabe: Fedora release 39 (Thirty Nine) === Red Hat Enterprise Linux / CentOS / Rocky / Alma === cat /etc/redhat-release # RHEL: Red Hat Enterprise Linux release 9.3 (Plow) # CentOS: CentOS Stream release 9 # Rocky: Rocky Linux release 9.3 (Blue Onyx) # Alma: AlmaLinux release 9.3 (Shamrock Pampas Cat) ===== Methode 5: Kernel und System-Informationen ===== ==== uname - Kernel-Informationen ==== uname -a # Alle Informationen uname -r # Kernel-Version uname -m # Architektur uname -o # Betriebssystem **Beispiel-Ausgaben:** # Debian Linux debian 6.1.0-13-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.55-1 (2023-09-29) x86_64 GNU/Linux # Ubuntu Linux ubuntu 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux # Fedora Linux fedora 6.6.7-200.fc39.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 14 19:04:11 UTC 2023 x86_64 GNU/Linux # openSUSE Linux opensuse 5.14.21-150500.55.39-default #1 SMP PREEMPT_DYNAMIC Mon Dec 4 10:38:00 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux ==== Weitere Systeminformationen ==== # Detaillierte Hardware-Infos hostnamectl # Prozessor cat /proc/cpuinfo | grep "model name" | head -1 # Speicher free -h # Festplatten lsblk df -h ===== Methode 6: Paketmanager identifizieren ===== Die Art des Paketmanagers gibt Hinweise auf die Distribution. # Debian/Ubuntu/Mint verwenden apt/dpkg which apt which dpkg # Fedora/RHEL/CentOS verwenden dnf/yum/rpm which dnf which yum which rpm # SUSE/openSUSE verwenden zypper/rpm which zypper # Arch Linux verwendet pacman which pacman **Schnelltest:** if [ -f /etc/debian_version ]; then echo "Debian-basiert" elif [ -f /etc/fedora-release ]; then echo "Fedora" elif [ -f /etc/redhat-release ]; then echo "Red Hat basiert" elif [ -f /etc/SuSE-release ] || [ -f /etc/SUSE-brand ]; then echo "SUSE-basiert" elif [ -f /etc/arch-release ]; then echo "Arch Linux" fi ===== Praktische Skripte ===== ==== Alle Methoden kombiniert ==== #!/bin/bash # Distribution und Version anzeigen echo "=== /etc/os-release ===" if [ -f /etc/os-release ]; then source /etc/os-release echo "Name: $NAME" echo "Version: $VERSION" echo "ID: $ID" echo "Pretty Name: $PRETTY_NAME" fi echo "" echo "=== hostnamectl ===" if command -v hostnamectl >/dev/null 2>&1; then hostnamectl | grep "Operating System" fi echo "" echo "=== lsb_release ===" if command -v lsb_release >/dev/null 2>&1; then lsb_release -d fi echo "" echo "=== uname ===" uname -a echo "" echo "=== Kernel ===" uname -r ==== Distribution in Variable speichern ==== #!/bin/bash # Distribution ermitteln und speichern if [ -f /etc/os-release ]; then source /etc/os-release DISTRO=$ID DISTRO_VERSION=$VERSION_ID echo "Distribution: $DISTRO" echo "Version: $DISTRO_VERSION" # Distributionsspezifische Aktionen case $DISTRO in debian|ubuntu|linuxmint) echo "Debian-basiertes System erkannt" PKG_MANAGER="apt" ;; fedora|rhel|centos|rocky|almalinux) echo "Red Hat-basiertes System erkannt" PKG_MANAGER="dnf" ;; opensuse*|sles) echo "SUSE-basiertes System erkannt" PKG_MANAGER="zypper" ;; arch|manjaro) echo "Arch-basiertes System erkannt" PKG_MANAGER="pacman" ;; *) echo "Unbekannte Distribution" ;; esac echo "Paketmanager: $PKG_MANAGER" fi ===== Vergleichstabelle ===== ^ Distribution ^ Basis ^ Paketmanager ^ Hauptdatei ^ Besonderheit ^ | **Debian** | Debian | apt/dpkg | /etc/debian_version | Stabile Releases | | **Ubuntu** | Debian | apt/dpkg | /etc/lsb-release | LTS-Versionen | | **Linux Mint** | Ubuntu/Debian | apt/dpkg | /etc/lsb-release | Desktop-fokussiert | | **Fedora** | Red Hat | dnf/rpm | /etc/fedora-release | Cutting-edge | | **RHEL** | Red Hat | dnf/yum/rpm | /etc/redhat-release | Enterprise | | **CentOS Stream** | Red Hat | dnf/rpm | /etc/redhat-release | Rolling Release | | **Rocky Linux** | RHEL | dnf/rpm | /etc/redhat-release | RHEL-Klon | | **AlmaLinux** | RHEL | dnf/rpm | /etc/redhat-release | RHEL-Klon | | **openSUSE Leap** | SUSE | zypper/rpm | /etc/os-release | Stabil | | **openSUSE Tumbleweed** | SUSE | zypper/rpm | /etc/os-release | Rolling Release | | **SLES** | SUSE | zypper/rpm | /etc/os-release | Enterprise | | **Arch Linux** | Arch | pacman | /etc/os-release | Rolling Release | | **Manjaro** | Arch | pacman | /etc/os-release | Benutzerfreundlich | ===== Häufige Fragen ===== ==== Warum mehrere Methoden? ==== * Ältere Systeme haben oft nicht ''/etc/os-release'' * Verschiedene Tools für verschiedene Zwecke * Kompatibilität mit Skripten und Automatisierung * Unterschiedliche Detailstufen ==== Welche Methode ist die beste? ==== **Empfehlung:** - **Modern**: ''cat /etc/os-release'' oder ''hostnamectl'' - **Universell**: ''cat /etc/os-release'' funktioniert fast überall - **Detailliert**: ''hostnamectl'' auf systemd-Systemen - **Skripte**: ''/etc/os-release'' parsen ==== Was ist der Unterschied zwischen ID und ID_LIKE? ==== source /etc/os-release echo "ID: $ID" # Spezifische Distribution (z.B. "ubuntu") echo "ID_LIKE: $ID_LIKE" # Basis-Distribution (z.B. "debian") **ID_LIKE** ist nützlich für Skripte, die mehrere verwandte Distributionen unterstützen sollen. ===== Troubleshooting ===== ==== Datei /etc/os-release fehlt ==== # Sehr alte Distribution - alternative Methoden nutzen: cat /etc/*-release cat /etc/*_version lsb_release -a uname -a ==== lsb_release nicht gefunden ==== # Installieren: sudo apt install lsb-release # Debian/Ubuntu sudo dnf install redhat-lsb-core # Fedora/RHEL sudo zypper install lsb-release # openSUSE/SUSE ==== hostnamectl funktioniert nicht ==== System nutzt kein systemd - verwenden Sie andere Methoden: cat /etc/os-release lsb_release -a ===== Siehe auch ===== * [[sammlung:hostnamectl|hostnamectl - Hostname verwalten]] * [[sammlung:os_info|Betriebssystem-Informationen]] * [[sammlung:distro|Linux-Distributionen Übersicht]] * [[sammlung:paketmanagement|Paketverwaltung]] * [[sammlung:system_info_bordmittel|System-Informationen mit Bordmitteln]] ===== Weitere Informationen ===== man os-release man hostnamectl man lsb_release man uname **Online-Ressourcen:** * [[https://www.debian.org/|Debian]] * [[https://ubuntu.com/|Ubuntu]] * [[https://linuxmint.com/|Linux Mint]] * [[https://getfedora.org/|Fedora]] * [[https://www.opensuse.org/|openSUSE]] * [[https://www.suse.com/|SUSE]] ---- {{tag>cli system-info}} ----