Skip to content
Search AlmaLinux

    Browse this documentation

    AlmaLinux Command Cheat Sheet

    This cheat sheet collects commands for daily administration on AlmaLinux 9 and 10. Placeholders such as PACKAGE are for you to replace. Most commands that change the system need root, so they are shown with sudo.

    TaskCommand
    Show the AlmaLinux releasecat /etc/almalinux-release
    Turn on the CRB repositorysudo dnf config-manager --set-enabled crb
    Add EPEL packagessudo dnf install epel-release
    Install only security updatessudo dnf upgrade --security
    Check whether a reboot is needed after updatessudo dnf needs-restarting -r
    Inspect the last transactiondnf history info last
    Pick a module stream (AlmaLinux 9 only)sudo dnf module enable nodejs:22
    Find the package that ships a binarydnf provides '*bin/ss'
    TaskCommand
    Is a package installedrpm -q PACKAGE
    List files of an installed packagerpm -ql PACKAGE
    Which package owns a filerpm -qf /usr/bin/bash
    Show installed package detailsrpm -qi PACKAGE
    TaskCommand
    Start a servicesudo systemctl start SERVICE
    Stop a servicesudo systemctl stop SERVICE
    Enable at boot and start nowsudo systemctl enable --now SERVICE
    Show service statussystemctl status SERVICE
    Read a service’s logjournalctl -u SERVICE
    Follow the log livejournalctl -f
    Set the hostnamesudo hostnamectl set-hostname NAME
    Set the time zonesudo timedatectl set-timezone AREA/CITY
    TaskCommand
    Create a user with a home directorysudo useradd -m USER
    Add a user to the wheel (sudo) groupsudo usermod -aG wheel USER
    Lock a user’s passwordsudo passwd -l USER
    Delete a user and the home directorysudo userdel -r USER
    Change file modechmod 640 FILE
    Change file ownersudo chown USER:GROUP FILE
    TaskCommand
    Show addresses brieflyip -br addr
    Show listening TCP portsss -ltn
    Show NetworkManager connectionsnmcli connection show
    Allow a service through firewalldsudo firewall-cmd --permanent --add-service=SERVICE
    Reload firewalld rulessudo firewall-cmd --reload
    TaskCommand
    Show the SELinux modegetenforce
    Show detailed SELinux statussestatus
    Restore default file contextssudo restorecon -Rv DIR
    TaskCommand
    Disk usage by filesystemdf -h
    Directory sizedu -sh DIR
    Block deviceslsblk
    Memory usagefree -m
    Running processesps aux
    Live process viewtop
    TaskCommand
    AlmaLinux releasecat /etc/almalinux-release
    Kernel versionuname -r
    Architectureuname -m
    Uptimeuptime

    The commands in this sheet were checked in the official almalinux:9 and almalinux:10 container images on 2026-10-16: the tools were installed with DNF and each command was found on the path. Read-only DNF and RPM queries were run, and user creation, locking, group changes and deletion were run. Service control, firewalld rules and SELinux changes need a full system with systemd and were not run in a container, so test them on a non-production machine first.