Skip to content

AlmaLinux Command Cheat Sheet

This cheat sheet collects the most commonly used commands for day-to-day operations on AlmaLinux 9 / 10, organized by function. Unless otherwise noted, most commands require root privileges or should be prefixed with sudo.

Package Management (DNF)

OperationCommand
Search for a packagednf search <keyword>
Install a packagednf install <package>
Remove a packagednf remove <package>
Upgrade all installed packagesdnf upgrade
Check for available updates onlydnf check-update
Find the package providing a file/capabilitydnf provides <file path or capability>
List enabled repositoriesdnf repolist
List all repositories (including disabled)dnf repolist --all
Clean the cachednf clean all
Rebuild the metadata cachednf makecache
View transaction historydnf history
Roll back a specific transactiondnf history undo <ID>
List module streamsdnf module list
Enable and install a module streamdnf module install <module>:<stream>
List package groupsdnf group list
Install a package groupdnf group install "<group name>"
View package informationdnf info <package>
List a package's dependenciesdnf repoquery --requires <package>

Service Management (systemctl)

OperationCommand
Start a servicesystemctl start <service>
Stop a servicesystemctl stop <service>
Restart a servicesystemctl restart <service>
Reload configuration (without interruption)systemctl reload <service>
View service statussystemctl status <service>
Enable a service at bootsystemctl enable <service>
Disable a service at bootsystemctl disable <service>
Enable and start immediatelysystemctl enable --now <service>
List running unitssystemctl list-units
List all service unitssystemctl list-units --type=service
Check whether a service is runningsystemctl is-active <service>
Check whether a service starts at bootsystemctl is-enabled <service>
Reload the systemd configurationsystemctl daemon-reload

Viewing Logs (journalctl)

OperationCommand
View logs for a specific servicejournalctl -u <service>
Follow logs in real timejournalctl -f
Follow logs for a specific servicejournalctl -u <service> -f
Filter by priority (e.g. errors)journalctl -p err
View logs after a given timejournalctl --since "2026-06-01 08:00:00"
View logs since the current bootjournalctl -b
View logs from the previous bootjournalctl -b -1
View disk space used by logsjournalctl --disk-usage
Clean logs by sizejournalctl --vacuum-size=500M
Clean logs by timejournalctl --vacuum-time=2weeks

Firewall (firewalld)

OperationCommand
View firewall running statefirewall-cmd --state
View all rules in the current zonefirewall-cmd --list-all
Permanently allow a servicefirewall-cmd --permanent --add-service=http
Permanently allow a portfirewall-cmd --permanent --add-port=8080/tcp
Reload rules to apply permanent configfirewall-cmd --reload
View the default zonefirewall-cmd --get-default-zone
List all zonesfirewall-cmd --get-zones
Bind an interface to a zonefirewall-cmd --permanent --zone=public --change-interface=eth0
Add a rich rulefirewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="192.168.1.0/24" service name="ssh" accept'

SELinux

OperationCommand
View the current modegetenforce
Temporarily switch to permissive modesetenforce 0
Temporarily switch to enforcing modesetenforce 1
View detailed SELinux statussestatus
Restore a file's default contextrestorecon -Rv <path>
Permanently set a booleansetsebool -P httpd_can_network_connect on
Add a type label to a portsemanage port -a -t http_port_t -p tcp 8080
View SELinux denial recordsausearch -m avc -ts recent
Analyze denials and get suggestionssealert -a /var/log/audit/audit.log

Networking (NetworkManager)

OperationCommand
List connection profilesnmcli con show
List network devicesnmcli dev status
Bring up a connectionnmcli con up <connection>
Set a static IPnmcli con mod <connection> ipv4.addresses 192.168.1.10/24 ipv4.method manual
Set DNSnmcli con mod <connection> ipv4.dns "8.8.8.8 1.1.1.1"
View IP addressesip addr
View the routing tableip route
View listening ports (ss recommended)ss -tulpn

Users and Permissions

OperationCommand
Create a useruseradd <username>
Set/change a passwordpasswd <username>
Add a user to a supplementary groupusermod -aG wheel <username>
View/change password agingchage -l <username>
Safely edit sudoersvisudo
Change file permissionschmod 640 <file>
Change file owner and groupchown user:group <file>
View ACL permissionsgetfacl <file>
Set ACL permissionssetfacl -m u:user:rw <file>

Storage Management

OperationCommand
View the block device treelsblk
View partition UUID/filesystemblkid
View disk usage (with type)df -hT
View directory usagedu -sh <directory>
Mount a filesystemmount /dev/sdb1 /mnt
Make a mount persistentEdit /etc/fstab
Extend a logical volumelvextend -L +10G /dev/vg0/lv0
Grow an XFS filesystem onlinexfs_growfs /
Grow an ext4 filesystem onlineresize2fs /dev/vg0/lv0

Processes and Performance

OperationCommand
View all processesps aux
Monitor processes in real timetop
Enhanced interactive monitoringhtop
View memory usagefree -h
View system load and uptimeuptime
View resource usage by cgroupsystemd-cgtop
View resources for a specific processps -p <PID> -o %cpu,%mem,cmd

System Information

OperationCommand
View hostname and system infohostnamectl
Set the timezonetimedatectl set-timezone Asia/Shanghai
View the AlmaLinux versioncat /etc/almalinux-release
View the kernel versionuname -r
View the DNF versiondnf --version
View CPU informationlscpu
View time and timezone statustimedatectl

Further Reading

Released under the MIT License