Skip to content
Search Fedora

    Browse this documentation

    Fedora command cheat sheet (F45-ready)

    One page of commands. Everything follows the actual F45 / dnf5 5.4 argument shapes — dnf5 is not compatible with dnf4 on several subcommands, and the ones that break when copied are listed at the end.

    Terminal window
    cat /etc/os-release # release and variant
    rpm -q rpm dnf5 kernel # key component versions
    uname -r # kernel
    hostnamectl # host overview

    On F45, rpm -q rpm should report rpm-6.1.x; if it still says 6.0.x, you are on F44.

    GoalCommand
    Installsudo dnf install <pkg>
    Searchdnf search <term>
    Find the package owning a filednf provides '*/libssl.so.3'
    Package detailsdnf info <pkg>
    List installeddnf list --installed
    Removesudo dnf remove <pkg>
    Install a local filesudo dnf install ./x.rpm (warns only — see the signature page)
    Build dependencies from a specsudo dnf builddep x.spec
    Mark as user-installedsudo dnf mark install <pkg>
    Groupssudo dnf group install '<name>'
    Swap one package for anothersudo dnf swap <old> <new>
    Terminal window
    dnf repolist # enabled only
    dnf repolist --all # includes disabled (use this to copy repo IDs)
    dnf repoinfo <id> # effective enabled / gpgcheck for one repo
    sudo dnf --enablerepo=<id> install <pkg> # enable for one command
    sudo dnf config-manager setopt <id>.enabled=0 # disable persistently
    sudo dnf config-manager addrepo --from-repofile=<url>
    sudo dnf clean all && sudo dnf makecache

    The F45 location changes (the easiest thing to trip over):

    ItemF44 and earlierF45
    Packaged repositories/etc/yum.repos.d/usr/share/dnf5/repos.d
    GPG keys/etc/pki/rpm-gpg/usr/share/pki/rpm-gpg
    Custom repositories/etc/yum.repos.dunchanged
    Override file—/etc/dnf/repos.override.d/99-config_manager.repo
    Terminal window
    ls /usr/share/dnf5/repos.d/
    rpm -qf /usr/share/dnf5/repos.d/fedora.repo # if it names a package, do not edit by hand

    See repository configuration moves to /usr.

    Terminal window
    sudo dnf upgrade --refresh # refresh metadata and upgrade
    sudo dnf updateinfo list --updates # pending security and bugfix updates
    sudo dnf needs-restarting # is a reboot needed
    sudo dnf distro-sync # align to the current repository versions
    dnf history list # transaction history
    sudo dnf history undo <id> # roll back one transaction

    Measured needs-restarting output:

    No core libraries or services have been updated since boot-up.
    Reboot should not be necessary.
    Terminal window
    rpm -K pkg.rpm # check signature and digests
    rpm -qpi pkg.rpm | head -10 # package metadata
    sudo rpm --import RPM-GPG-KEY-fedora # import a public key
    rpm --addsign pkg.rpm # sign a package
    sudo rpm -i --nosignature pkg.rpm # allow one unsigned package

    Since F45, rpm 6.1 enforces signatures: rpm -i refuses unsigned packages, dnf from a repository refuses too, and dnf install ./x.rpm only warns. See signature enforcement.

    Terminal window
    sudo dnf upgrade --refresh # bring the current release up to date first
    sudo dnf system-upgrade download --releasever=45 # download the new release
    sudo dnf system-upgrade reboot # reboot into the offline transaction
    sudo dnf system-upgrade clean # clean the download cache

    Recovering from a failed upgrade is in troubleshooting a failed upgrade; version-specific steps are in upgrading to Fedora 45.

    Terminal window
    sudo dnf install toolbox # Cloud/Server need this manually
    toolbox create [name] # create a container
    toolbox enter [name] # enter it
    toolbox run <cmd> # run without entering
    toolbox list # list
    toolbox rm <name> # remove
    Terminal window
    podman version && podman info # version and backends
    podman ps -a # including stopped containers
    podman images
    podman run --rm -it fedora:45 bash
    flatpak remotes # connected application sources
    flatpak list --app
    Terminal window
    systemctl status <unit> --no-pager
    journalctl -b -u <unit> --no-pager | tail -50
    journalctl -p err -b --no-pager | tail -30
    lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS
    df -h / /var /boot
    cat /sys/class/vtconsole/*/name # console backend

    For matching error text, see error lookup.

    9. dnf5 versus dnf4 (the ones that break when copied)

    Section titled “9. dnf5 versus dnf4 (the ones that break when copied)”
    dnf4 formResult on dnf5Use instead
    dnf updateinfo --summaryUnknown argumentupdateinfo list --updates
    dnf updateinfo --listUnknown argumentupdateinfo list
    dnf config-manager --add-repoargument does not existconfig-manager addrepo --from-repofile=
    dnf repoquery --requiresworks, different output formatcheck --help first
    dnf groupinstalldoes not existdnf group install
    Terminal window
    systemctl status <unit> --no-pager # one service
    systemctl list-units --failed # services that failed this boot
    systemctl list-unit-files | grep <term> # does the unit exist
    sudo systemctl enable --now <unit> # enable at boot and start now
    sudo systemctl disable --now <unit> # disable and stop
    sudo systemctl mask <unit> # block entirely (stronger than disable)
    sudo systemctl unmask <unit>
    systemctl cat <unit> # the unit file itself
    systemctl show <unit> -p LoadState -p ActiveState
    systemctl list-timers --all # scheduled jobs (the cron replacement)
    journalctl -b -1 -p err --no-pager | tail -30 # errors from the previous boot
    Terminal window
    lsblk -o NAME,SIZE,FSTYPE,MOUNTPOINTS,UUID
    df -h / /var /boot
    df -i /var # exhausted inodes also read as "no space"
    du -xh --max-depth=1 /var | sort -h | tail -10
    findmnt # all mount relationships
    sudo mount -o remount,rw / # make a read-only root writable temporarily
    sudo fsck -n <device> # read-only check
    Terminal window
    ip -br addr # addresses at a glance
    ip route # routing table
    nmcli dev status # devices and connection state
    nmcli con show # connection names (case sensitive)
    nmcli con up <name>
    getent hosts <name> # resolution only, not connectivity
    cat /etc/resolv.conf
    ss -tlnp # listening sockets and processes
    sudo firewall-cmd --state # only if firewalld is installed
    sudo firewall-cmd --list-all
    ping -c1 <IP> # test IP before names
    Terminal window
    podman ps -a # including stopped
    podman logs <container>
    podman exec -it <container> bash
    podman inspect <container> | head -20
    podman system df # space used by images and containers
    podman system prune -a # cleanup (use with care)
    systemctl --user daemon-reload # required after editing a Quadlet
    systemctl --user list-unit-files "*.service" | grep generated
    loginctl enable-linger $USER # keep containers running after logout
    Terminal window
    id # your uid/gid and groups
    getent passwd <user>
    sudo useradd -m -G wheel <user>
    sudo passwd <user>
    sudo usermod -aG wheel <user> # append to a group; do not drop -a
    sudo -l # what the current user may do
    ls -lZ <path> # permissions plus SELinux labels
    getenforce # Enforcing / Permissive
    sudo ausearch -m AVC -ts recent # recent denials
    sudo restorecon -Rv <path> # restore default labels
    Terminal window
    journalctl -b --no-pager | tail -50
    journalctl -p err -b --no-pager | tail -30
    journalctl -u <unit> -f # follow one service
    journalctl --disk-usage
    sudo journalctl --vacuum-size=500M
    journalctl -k -b | tail -30 # kernel only
    dmesg -T | tail -30 # with human-readable timestamps
    cat /sys/class/vtconsole/*/name # which console backend is bound

    Run it before and after upgrading; the diff is exactly “what this changed”:

    #!/bin/bash
    echo "== $(grep VERSION_ID /etc/os-release)"
    echo "kernel: $(uname -r)"
    for p in systemd glibc python3 openssl dnf5 rpm podman kmscon; do
    printf "%-10s %s\n" "$p" "$(rpm -q --qf '%{VERSION}-%{RELEASE}' "$p" 2>/dev/null || echo '-')"
    done
    echo "repos: /usr=$(ls /usr/share/dnf5/repos.d/*.repo 2>/dev/null | wc -l) /etc=$(ls /etc/yum.repos.d/*.repo 2>/dev/null | wc -l)"
    echo "failed units: $(systemctl --failed --no-legend | wc -l)"

    The full comparison is in the version matrix.