Home / Linux Cheat Sheet – AlmaLinux 8, CentOS 8, CentOS 7, CentOS 6, CentOS 5

Linux Cheat Sheet – AlmaLinux 8, CentOS 8, CentOS 7, CentOS 6, CentOS 5

linux

Basic System Commands

TASKCentOS5CentOS6CentOS7CentOS8/AlmaLinux8
Graphical configuration tools
  • system-config-*
  • system-config-*
  • gnome-control-center
  • gnome-control-center
Text-based configuration tools
  • system-config-*-tui
  • system-config-*-tui
Configure printer
  • system-config-printer
  • system-config-printer
  • system-config-printer
  • gnome-control-center
Configure network
  • system-config-network
  • system-config-network
  • nmcli
  • nmtui
  • nm-connection-editor
  • nmcli
  • nmtui
  • nm-connection-editor
  • gnome-control-center
Configure system language
  • system-config-language
  • system-config-language
  • localectl
  • localectl
  • gnome-control-center
Configure time and date
  • system-config-date
  • date
  • system-config-date
  • date
  • timedatectl
  • date
  • timedatectl
  • date
  • gnome-control-center
Synchronize time and date
  • ntpdate
  • /etc/ntp.conf
  • ntpdate
  • /etc/ntp.conf
  • timedatectl
  • /etc/chrony.conf
  • ntpdate
  • timedatectl
  • date
  • /etc/chrony.conf
  • chronyc
Configure keyboard
  • system-config-keyboard
  • system-config-keyboard
  • localectl
  • localectl
  • gnome-control-center
Configure SSH
  • /etc/ssh/ssh_config
  • /etc/ssh/sshd_config
  • ~/.ssh/config
  • ssh-keygen
  • /etc/ssh/ssh_config
  • /etc/ssh/sshd_config
  • ~/.ssh/config
  • ssh-keygen
  • /etc/ssh/ssh_config
  • /etc/ssh/sshd_config
  • ~/.ssh/config
  • ssh-keygen
  • /etc/ssh/ssh_config
  • /etc/ssh/sshd_config
  • ~/.ssh/config
  • ssh-keygen

Server Basic Info

TASKCentOS5CentOS6CentOS7CentOS8/AlmaLinux8
View version information
  • hostnamectl
  • rpm -qa centos-release
  • cat /etc/os-release
  • cat/etc/centos-release
  • hostnamectl
  • rpm -qa centos-release
  • cat /etc/os-release
  • cat/etc/centos-release
  • hostnamectl
  • rpm -qa centos-release
  • cat /etc/os-release
  • cat/etc/centos-release
  • hostnamectl
  • rpm -qa centos-release
  • cat /etc/os-release
  • cat/etc/centos-release
View system profile
  • sosreport
  • dmidecode
  • hwbrowser
  • sosreport
  • dmidecode
  • lstopo
  • lscpu
  • sosreport
  • dmidecode
  • lstopo
  • lscpu
  • sosreport
  • dmidecode
  • lstopo
  • lscpu
  • cat /proc/cpuinfo
  • lshw

Boot & Kernel

TASKCentOS5CentOS6CentOS7CentOS8/AlmaLinux8
Single user/rescue mode
  • append 1 or s or init=/bin/bash to kernel cmdline
  • append 1 or s or init=/bin/bash to kernel cmdline
  • append 1 or s or rd.break or init=/bin/bash to kernel cmdline
  • append 1 or s or rd.break or init=/bin/bash to kernel cmdline
Shut down system
  • shutdown
  • shutdown
  • shutdown
  • shutdown
Power off system
  • poweroff
  • poweroff
  • poweroff
  • systemctl poweroff
  • poweroff
  • systemctl poweroff
  • Halt system
  • halt
  • halt
  • halt
  • systemctl halt
  • halt
  • systemctl halt
Reboot system
  • reboot
  • reboot
  • reboot
  • systemctl reboot
  • reboot
  • systemctl reboot
Configure default run level/target
  • /etc/inittab
  • /etc/inittab
  • systemctl set-default
  • systemctl set-default
Configure GRUB bootloader
  • /boot/grub/grub.conf
/boot/grub/grub.conf
  • /etc/default/grub
  • grub2-mkconfig
  • grub-set-default
  • /etc/default/grub
  • grub2-mkconfig
  • grub-set-default
Configure kernel module
  • modprobe
  • modprobe
  • modprobe
  • modprobe
View hardware configured
  • hwbrowser
  • lshw
  • lshw 
  • lshw
Configure hardware device
  • udev
  • udev
  • udev
  • udev
View kernel parameters
  • sysctl -a
  • cat /proc/cmdline
  • sysctl -a
  • cat /proc/cmdline
  • sysctl -a
  • cat /proc/cmdline
  • sysctl -a
  • cat /proc/cmdline
Load kernel module
  • modprobe
  • modprobe
  • modprobe
  • modprobe
View kernel version
  • rpm -q kernel
  • uname -r
  • rpm -q kernel
  • uname -r
  • rpm -q kernel
  • uname -r
  • rpm -q kernel
  • uname -r
Remove kernel module
  • modprobe -r
  • modprobe -r
  • modprobe -r
  • modprobe -r

Software Installation

TASKCentOS5CentOS6CentOS7CentOS8/AlmaLinux8
View software info
  • yum info
  • yum groupinfo
  • yum info
  • yum groupinfo
  • yum info
  • yum group info
  • yum info
  • yum group info
Install software
  • yum install
  • yum groupinstall
  • yum install
  • yum groupinstall
  • yum install
  • yum group install
  • yum install
  • yum group install
Upgrade software
  • yum upgrade
  • yum upgrade
  • yum upgrade
  • yum upgrade
Update software
  • yum update
  • yum update
  • yum update
  • yum update
Find package owning file
  • rpm -qf  file-name
  • yum provides file-name
  • rpm -qf  file-name
  • yum provides file-name
  • rpm -qf  file-name
  • yum provides file-name
  • rpm -qf  file-name
  • yum provides file-name
Configure software repository
  • subscription-manager repos /etc/yum.repos.d/*.repo
  • subscription-manager repos /etc/yum.repos.d/*.repo
  • subscription-manager repos /etc/yum.repos.d/*.repo
  • subscription-manager repos /etc/yum.repos.d/*.repo
View software version
  • rpm -q package-name
  • rpm -q package-name
  • yum list installed package-name
  • rpm -q package-name
  • yum list installed package-name
  • rpm -q package-name
View installed software
  • rpm -qa
  • yum list installed
  • rpm -qa
  • yum list installed
  • rpm -qa
  • yum list installed
  • rpm -qa
  • yum list installed
Install a module
  • yum module install module-name
  • yum module install module-name
View info on a module
  • yum module info module-name
  • yum module info module-name
List available modules
  • yum module list
  • yum module list

Server Services

TASKCentOS5CentOS6CentOS7CentOS8/AlmaLinux8
List running services
  • service --status-all
  • service --status-all
  • systemctl -t service --state=active
  • systemctl -t service --state=active
List all services
  • chkconfig --list
  • ls /etc/init.d/
  • chkconfig --list
  • ls /etc/init.d/
  • systemctl -at service
  • ls /etc/systemd/system/*.service
  • ls /usr/lib/systemd/system/*.service
  • systemctl list-units -at service
  • find /etc/systemd/ /usr/lib/systemd/ /run/systemd/ -name *.service"
Enable or disable service
  • chkconfig service-name on
  • chkconfig name off
  • chkconfig service-name on
  • chkconfig name off
  • systemctl enable name.service
  • systemctl disable name.service
  • systemctl enable name.service
  • systemctl disable name.service
Start or stop service
  • service service-name start
  • service service-name stop
  • chkconfig service-name on
  • chkconfig service-name off
  • systemctl enable name.service
  • systemctl disable name.service
  • systemctl enable name.service
  • systemctl disable name.service
Check if the service is enabled
  • chkconfig name --list
  • chkconfig name --list
  • systemctl is-enabled name
  • systemctl is-enabled name
View service status
  • service name status
  • service name status
  • systemctl status name.service
  • systemctl status name.service
Modify configuration or Create new service file
  • chkconfig --add
  • chkconfig --add
  • systemctl daemon-reload
  • /etc/systemd/system/*.service
  • systemctl daemon-reload
  • /etc/systemd/system/*.service
View run level/target
  • runlevel
  • who -r
  • runlevel
  • who -r
  • systemctl get-default
  • who -r
  • systemctl get-default
  • who -r
Change run level/target
  • /etc/inittab
  • init run_level
  • /etc/inittab
  • init run_level
  • systemctl isolate name.target
  • systemctl set-default
  • systemctl isolate name.target
  • systemctl set-default
Configure logging
  • /etc/syslog.conf
  • /etc/rsyslog.conf
  • /etc/rsyslog.conf
  • /etc/rsyslog.d/*.conf
  • /var/log/journal
  • systemd-journald.service
  • /etc/rsyslog.conf
  • /etc/rsyslog.d/*.conf
  • /var/log/journal
  • systemd-journald.service
Configure system audit
  • add  audit=1 to kernel cmdline
  • auditctl
  • /etc/audit/auditd.conf
  • /etc/audit/audit.rules
  • authconfig
  • /etc/pam.d/system-auth
  • pam_tty_audit kernel module
  • add  audit=1 to kernel cmdline
  • auditctl
  • /etc/audit/auditd.conf
  • /etc/audit/audit.rules
  • authconfig
  • /etc/pam.d/system-auth
  • pam_tty_audit kernel module
  • add  audit=1 to kernel cmdline
  • auditctl
  • /etc/audit/auditd.conf
  • /etc/audit/audit.rules
  • authconfig
  • /etc/pam.d/system-auth
  • pam_tty_audit kernel module
  • add audit=1 to kernel cmdline
  • auditctl
  • /etc/audit/auditd.conf
  • /etc/audit/audit.rules
  • authconfig
  • /etc/pam.d/system-auth
  • tlog
View audit output
  • aureport
  • /var/log/faillog
  • aureport
  • /var/log/faillog
  • /var/log
  • journalctl
Schedule tasks
  • cron
  • at
  • batch
  • cron
  • at
  • batch
  • cron
  • at
  • batch
  • cron
  • at
  • batch
  • systemd-run --on-calendar
Find file by name
  • locate
  • locate
  • locate
  • locate
Find file by property
  • find
  • find
  • find
  • find
Create archive
  • tar
  • cpio
  • zip
  • xz
  • tar
  • cpio
  • zip
  • xz
  • tar
  • cpio
  • zip
  • xz
  • tar
  • cpio
  • zip
  • xz
View logs
  • /var/log
  • /var/log
  • /var/log
  • journalctl
  • /var/log
  • journalctl

User operations

TASKCentOS5CentOS6CentOS7CentOS8/AlmaLinux8
Create user account
  • useradd
  • useradd
  • useradd
  • useradd
Graphical user management
  • system-config-users
  • system-config-users
  • system-config-users
  •  system-config-users
  • gnome-control-center
Delete user account
  • userdel
  • userdel
  • userdel
  • userdel
View or change user account details
  • usermod
  • /etc/passwd
  • vipw
  • id
  • usermod
  • /etc/passwd
  • vipw
  • id
  • usermod
  • /etc/passwd
  • vipw
  • id
  • usermod
  • /etc/passwd
  • vipw
  • id
Create user group
  • groupadd
  • groupadd
  • groupadd
  • groupadd
Change group details
  • groupmod
  • /etc/group
  • groupmod
  • /etc/group
  • groupmod
  • /etc/group
  • groupmod
  • /etc/group
Delete user group
  • groupdel
  • groupdel
  • groupdel
  • groupdel
Change user password
  • passwd
  • passwd
  • passwd
  • passwd
Change user permissions
  • usermod
  • visudo
  • usermod
  • visudo
  • usermod
  • visudo
  • usermod
  • visudo
Change group permissions
  • visudo
  • groupmod
  • visudo
  • groupmod
  • visudo
  • groupmod
  • visudo
  • groupmod
Change password policy
  • chage
  • chage
  • chage
  • chage
View user sessions
  • w
  • w
  • w
  • w

Volumes, File systems, Storage

TASKCentOS5CentOS6CentOS7CentOS8/AlmaLinux8
Default file systemext3
  • ext4
  • xfs
  • xfs
Format disk partition
  • mkfs.filesystem_type (ext3)
  • mkswap
  • mkfs.filesystem_type (ext3)
  • mkswap
  • mkfs.filesystem type (ext3)
  • mkswap
  • ssm create
  • mkfs.filesystem type (ext3)
  • mkswap
  • ssm create
Create or modify disk partitions
  • parted
  • fdisk
  • parted
  • fdisk
  • fdisk
  • gdiskparted
  • ssm create
  • parted
  • fdisk
  • gdisk
  • ssm_create
Mount storage
  • mount
  • /etc/fstab
  • mount
  • /etc/fstab
  • mount
  • /etc/fstab
  • ssm mount
  • mount
  • /etc/fstab
  • ssm mount
Mount and activate swap
  • /etc/fstab
  • swapon -a
  • /etc/fstab
  • swapon -a
  • /etc/fstab
  • swapon -a
  • /etc/fstab
  • swapon -a
Configure static mounts
  • /etc/fstab
  • /etc/fstab
  • /etc/fstab
  • /etc/fstab
View logical volume
  • lvdisplay
  • lvs
  • vgdisplay
  • vgs
  • pvdisplay
  • pvs
  • lvdisplay
  • lvs
  • vgdisplay
  • vgs
  • pvdisplay
  • pvs
  • lvdisplay
  • lvs
  • vgdisplay
  • vgs
  • pvdisplay
  • pvs
  • lvdisplay
  • lvs
  • vgdisplay
  • vgs
  • pvdisplay
  • pvs
Create physical volume
  • pvcreate
  • pvcreate
  • pvcreate
  • ssm create
  • pvcreate
  • ssm create
Create volume group
  • vgcreate
  • vgcreate
  • vgcreate
  • ssm create
  • vgcreate
  • ssm create
Create logical volume
  • lvcreate
  • lvcreate
  • lvcreate
  • ssm create
  • lvcreate
  • ssm create
Extend volume
  • vgextend
  • lvextend
  • resize2fs
  • vgextend
  • lvextend
  • resize2fs
  • vgextend
  • lvextend
  • xfs_growfs
  • ssm resize
  • vgextend
  • lvextend
  • xfs_growfs
  • ssm resize
Shrink volumes
  • resize2fs
  • lvreduce
  • vgreduce
  • resize2fs
  • lvreduce
  • vgreduce
Repair file system
  • fsck
  • fsck
  • fsck
  • ssm check
  • fsck
  • ssm check
View NFS share
  • showmount -e
  • mount
  • showmount -e
  • mount
  • showmount -e
  • mount
  • showmount -e
  • mount
Configure NFS share
  • /etc/exports
  • service nfs reload
  • /etc/exports
  • service nfs reload
  • /etc/exports
  • systemctl reload nfs.service
  • /etc/exports
  • systemctl reload nfs.service
Change file attributes
  • chattr
  • chattr
  • chattr
  • chattr
Change file permissions
  • chmod
  • chown
  • chgrp
  • umask
  • chmod
  • chown
  • chgrp
  • umask
  • chmod
  • chown
  • chgrp
  • umask
  • chmod
  • chown
  • chgrp
  • umask
Change access control list
  • setfacl
  • setfacl
  • setfacl
  • setfacl

Networking & routing

TASKCentOS5CentOS6CentOS7CentOS8/AlmaLinux8
Configure name resolution
  • /etc/hosts
  • /etc/resolv.conf
    • /etc/hosts
    • /etc/resolv.conf
    • /etc/hosts
    • /etc/resolv.conf
    • nmcli con mod
    • /etc/hosts
    • /etc/resolv.conf
    • nmcli con mod
    Configure hostname
    • /etc/sysconfig/network
    • /etc/sysconfig/network
    • hostnamectl
    • /etc/hostname
    • nmtui
    • hostnamectl
    • /etc/hostname
    • nmtui
    Network interface details
    • ip addr
    • ifconfig
    • brctl
    • ip addr
    • ifconfig
    • brctl
    • ip add
    • nmcli dev show
    • teamdctl
    • brctl
    • bridge
    • ip add
    • nmcli dev show
    • teamdctl
    • brctl
    • bridge
    View routes
    • ip route
    • ip route
    • ip route
    • ip route
    Configure routes
    • ip route add
    • system-config-network
    • /etc/sysconfig/route-iface
    • ip route add
    • system-config-network
    • /etc/sysconfig/route-iface
    • ip route add
    • nmcli
    • nmtui
    • nm-connection-editor
    • /etc/sysconfig/route-iface
      • ip route add
      • nmcli
      • nmtui
      • nm-connection-editor
      • /etc/sysconfig/route-iface

      Security management

      TASKCentOS5CentOS6CentOS7CentOS8/AlmaLinux8
      Server security
      • /etc/selinux/config
      • chcon
      • restorecon
      • semanage
      • setsebool
      • system-config-selinux
      • /etc/selinux/config
      • chcon
      • restorecon
      • semanage
      • setsebool
      • system-config-selinux
      • /etc/selinux/config
      • chcon
      • restorecon
      • semanage
      • setsebool
      • system-config-selinux
      • /etc/selinux/config
      • chcon
      • restorecon
      • semanage
      • setsebool
      • system-config-selinux
      LDAP, SSSD, Kerberos
      • authconfig
      • authconfig-tui
      • authconfig-gtk
      • authconfig
      • authconfig-tui
      • authconfig-gtk
      • authselect
      • authselect
      Network users
      • getent
      • getent
      • getent
      • getent

      Process management

      TASKCentOS5CentOS6CentOS7
      Trace library calls
      • ltrace
      • ltrace
      • ltrace
      Trace system calls
      • strace
      • strace
      • strace
      Change process run location
      • taskset
      • taskset
      • taskset
      Change process priority
      • nice
      • renice
      • nice
      • renice
      • nice
      • renice
      Kill process
      • kill
      • pkill
      • killall
      • kill
      • pkill
      • killall
      • kill
      • pkill
      • killall
      View system usage
      • top
      • ps
      • sar
      • iostat
      • netstat
      • vmstat
      • mpstat
      • numastat
      • top
      • ps
      • sar
      • iostat
      • netstat
      • ss
      • vmstat
      • mpstat
      • numastat
      • tuna
      • top
      • ps
      • sar
      • iostat
      • netstat
      • ss
      • vmstat
      • mpstat
      • numastat
      • tuna

      Leave a Reply