RedHat Linux is a widely used operating system that offers many powerful tools and commands. This Linux distro is popular for its reliability, security and enterprise-level development environments. In this article, I will give you an extensive list of various RedHat Linux commands along with a cheat sheet in different formats.
Download RedHat Linux Commands Cheat Sheet
Red Hat Linux Commands
RedHat Linux is a distribution of Linux operating systems developed by RedHat. It provides commands and tools of various categories such as system configuration, security and identity, system information, software management, file and disk management and so on. The list of this article includes frequently used RedHat Linux commands of each category.
System Configuration Commands
System configuration commands in Linux are used to manage and configure various settings of the operating system, networking, storage devices etc. of the system. RedHat Linux provides a variety of tools and commands to configure the above aspects of the system.
The commands below help a user retrieve various information about the system such as system resources, running processes, connections, etc. Service commands are used to start, stop, enable, disable and check the status of system services. The following list contains a few of them. Every Linux distro has a lot of file and disk management commands. The RedHat distro is no exception. These types of commands allow users to create, modify, delete, and mount files and directories. This section includes the software management commands of Red Hat Linux. These commands are super helpful to install, update and remove software packages from the system. There are a variety of commands in RedHat Linux to monitor and manage system resources. They provide information about the system’s resource allocation and performance issues. These types of commands are useful to create, manage, and extract files and directories from compressed archives. The below list contains only a few commands of this type RedHat Linux offers a wide range of network commands. These commands are useful for checking network connectivity, testing DNS resolution, diagnosing network issues, and so on. The following commands are frequently used to manage and troubleshoot network-related problems. Commands of this section are crucial to update the kernel, configure boot options and manage hardware resources etc. The brief list below may help a user quickly recall important commands to perform the above tasks. Use RedHat user management commands to create, modify, and delete users and groups, as well as to manage user privileges. Frequently used commands of this type are listed below: Commands of this section are used to monitor system activity, configure security settings and protect against unauthorized access. The following brief list of commands will help a user to perform the above tasks quite easily: In conclusion, the RedHat Linux commands cheat sheet provides a quick reference for accessing various commands of different categories. It can be handy for any users to execute necessary commands in the quickest amount of time.Commands
Description
system -config -*
Configure various system settings
system -confiq -*-tui
Open text user interface version of system configuration tool
system -confiq -printer
Configure printer settings
system -confiq -date
Configure date and time settings
timedatectl
View and modify system’s date and time
date
Displays current date and time in the system’s default format
ntpdate
Manually synchronize system’s clock with a specified NTP server
chronyc
Monitor and manage system’s time synchronization
system -confiq -keyboard
Configure keyboard settings
localectl
Query and configure system’s locale and keyboard settings
ssh -keygen
Generate, manage and convert authentication keys
System Information Commands
Commands
Description
subscription -manager identity
Display the identity of the currently subscribed system in Red Hat’s subscription management system
rhn_register
Register with Red Hat network Classic for software updates and support
sosreport
Collect system diagnostic information for troubleshooting purposes
demidecode
Display hardware information
lstopo
Display the topology of the system’s hardware, such as CPU cores and caches
lscpu
Display information about the system’s CPU architecture
cat /proc/cpuinfo
Display detailed information about the system’s CPU
Services Commands
Commands
Description
chkconfig –list
Displays the current status of services
ls /etc/init.d/
Lists the available startup scripts
systemctl -at service
Displays a list of all available services on the system
ls /etc/systemd/system/*.service
Lists all systemd unit files ending in .service
service — status -all
Displays the status of all available system services
systemctl -t service — state=active
Displays a list of active services managed by systemd
service name start
Starts the specified system service
service name stop
Stops the specified system service
systemctl start name .service
Starts the specified systemd service
systemctl stop name .service
Stops the specified systemd service
chkconfig name on
Enables the specified service to start automatically at boot time
chkconfig name off
Disables the specified service from starting automatically at boot time
systemctl enable name.service
Enables the specified systemd service to start automatically at boot time
systemctl disable name.service
Disables the specified systemd service from starting automatically at boot time
service name status
Displays the status of the specified system service
File and Disk Management Commands
Commands
Description
xfs
A file system format that supports large file sizes, high scalability and fast performance
gdisk
Manage GPT partition tables
ssm_create
Creates simple storage service volumes on AWS
fdisk
Manage traditional MBR partition tables
parted
Manage partition tables including support for GPT and MBR formats
ssm create
Create and manage SSM volumes on AWS
mkswap
Format a device or partition as swap space
mkfs.filesystem_type (ext4, xfs)
Format a device or partition with a specified file system type, such as ext4 or xfs
xfs_fsr
Defragment XFS file systems
ssm mount
Mount SSM volumes on AWS
fsck (look for ‘non-contiguous inodes’)
Check and repair the file system on a device or partition including checking for non-contiguous inodes
mount
Mount a file system to a specific directory
swapon -a
Activate all defined swap devices
lvdisplay
Display information about logical volumes
lvs
Display a summary of logical volumes
vgdisplay
Display information about volume groups
vgs
Display a summary of volume groups
pvdisplay
Display information about physical volumes
pvs
Display a summary of physical volumes
ssm create (if backend in lvm)
Create an SSM volume using Logical Volume Manager as the backend on AWS
pvcreate
Initialize a physical volume for use with LVM
vgcreate
Create a new volume group using one or more physical volumes
lvcreate
Create a new logical volume within a volume group
xfs_growfs
Expand an XFS file system after resizing a logical volume or partition
ssm resize
Resize an SSM volume on AWS
vgextend
Add one or more physical volumes to an existing volume group
lvextend
Expand the size of an existing logical volume
lvreduce
Shrink the size of an existing logical volume
ssm check
Check the health status of SSM volumes on AWS
showmount -e
Display the NFS exports on a given NFS server
systemctl reload nfs.service
Reload the configuration of the NFS service
chmod
Change the permissions of a file or directory
chown
Change the owner of a file or directory
chgrp
Change the group ownership of a file or directory
umask
Set the default file creation permissions
chattr
Set or remove file attributes such as making a file immutable or undeletable
setfacl
Modify file access control lists which allow fine-grained control over file permissions and access
Software Management Commands
Commands
Description
yum install
Install packages and dependencies from configured repositories
yum group install
Install a group of related packages from configured repositories
yum info
Display information about a specific package, including its version, size, and dependencies
yum group info
Display information about a group of packages and their dependencies
yum update
Update installed packages to the latest available versions
yum upgrade
Upgrade all packages on the system to their latest available versions
subscription -manager repos
Manage subscriptions and repositories
rpm -qf
Display the package name that owns a specified file
yum provides filenames -glob
Display which package provides a specific file or feature
rpm -q packagename
Display information about a specified package, including its version and architecture
yum list installed
Display a list of all installed packages
yum module install
Install a specific module stream and its dependencies
yum module info
Display information about a module, including its streams and profiles
yum module remove module_name:stream
remove a specific module stream and its dependencies
yum module reset module:stream
reset a specific module stream and remove all of its profiles
yum module list
Display a list of all available modules and their streams
rpm –checksig
Check RPM signature
Resource Management Commands
Commands
Description
strace
Traces system calls signals of a running program
ltrace
Traces library calls of a running program
nice or renice
Sets and modifies the priority of a running process
taskset
Assigns a specific processor or a set of processors to a running process
kill
Terminate a running process
pkill
Terminate a process or processes by their name or other attribute
killall
Terminate all processes with a specific name
ss
Displays network connections statistics and information
tuna
Tune system performance
pcp atop
Monitors system resources and performance, including CPU usage, memory usage, and disk I/O
top
Displays real-time information about the processes running on the system
ps
Displays a snapshot of the processes running on the system, including process IDs, resource usage, and other attributes
sar
Collects and reports system activity data, including CPU usage, memory usage, disk I/O, and network activity
iostat
Reports input/output statistics for block devices, including CPU utilization, I/O operations per second
vmstat
Displays virtual memory statistics, including systemwide statistics on CPU usage, memory usage, and disk I/O
mpstat
Reports processor-related statistics, including utilization, idle time, and other metrics
numastat
Reports non-uniform memory access allocation statistics for a system
pcp dstat
Collects system performance data
pmiostat
Reports input/output statistics for block devices with advanced features
df
Reports disk usage statistics for a file system, including the amount of free and used space
Archieve Commands
Commands
Description
tar
Create, extract and manage files in various archive formats
cpio
Create or extract archives in the cpio format
zip
Compress files and directories into a .zip archive format
xz
Compress and decompress files using .xz compression format
Network Commands
Commands
Description
dig
Queries DNS servers to get DNS details
nmcli
Manage network connections
ip addr show
Display IP addresses and network information of the system
nmcli con show
Show the available network connections and their status
address
Specifies the IP address to assign to a network interface
nmcli con up
Bring up a network connection
nmcli con mod
Modify a network connection
hostnamectl set-hostname
Set the system’s hostname
netstat -rn
Display the system’s routing table
route -n
Show the routing table of the system
tcpdump -i
Capture and analyze network traffic
tcpdump
Capture and analyze network packets
ping
Test connectivity between two network hosts
telnet
Connect to a remote host using the Telnet protocol
nslookup
Query DNS servers to get information about domain names and IP addresses
netstat
Display network connections and routing tables
Kernel, Boot and Hardware Management Commands
Commands
Description
append 1 or s or rd.break
Adds kernel boot parameters to modify the default behavior during boot process
init=/bin/bash
Tells the init process to start a bash shell
shutdown
Stops the system and powers it off
systemctl poweroff
Shuts down the system and turns off the power
poweroff
Shuts down the system and turns off the power
systemctl halt
Halts the system and leaves it powered on
halt
Halts the system and leaves it powered on
systemctl reboot
Reboots the system
reboot
Reboots the system
systemctl set -default
Sets the default for the system at the boot time
grub2 -mkconfig
Regenerate GRUB configuration file
grub -set -default
Sets the default GRUB entry
lshw
Displays detailed information about the system’s hardware configuration
modprobe
Add or remove kernel modules from the Linux kernel
udev
Dynamic device management system for Linux
sysctl -a
Displays kernel parameters and their values
modprobe -r
Remove kernel modules from the Linux kernel
rpm -q kernel uname -r
Display information about the installed kernel version
User Management Commands
Commands
Description
system -config -user
Manage user and group accounts
gnome -control -center
Manage system settings
useradd
Create a new user
userdel
Delete a user account
usermod
Modify an existing user account
vipw
Edit /etc/passwd file
id
Display user and group ID information
groupadd
Create a new group
groupdel
Delete a group
groupmod
Modify an existing group
/etc/group
Stores group information
passwd
Change a user’s password
visudo
Edit /etc/sudoers file
chage
Manage password expiration and aging policies
w
Display information about logged-in users
Security and Identity Commands
Commands
Description
semanage
Manage SELinux policy modules and configuration
setsebool
Modify SElinux boolean values
system -config -selinux
Manage SELinux policy settings
restorecon
Restore default SELinux security contexts on files and directories
chcon
Modify SELinux security contexts on files and directories
sealert
Analyze SELinux audit logs and provide recommendations for policy changes
authconfig
Configure various system authentication settings, including LDAP and Kerberos
authconfiq -tui
Launch the text-based user interface version of the authconfig tool
authconfiq -gtk
Launch the graphical user interface version of the authconfig tool
authselect
Configure authentication settings for local users and services
getend
Retrieve system account information, including user and group information
Conclusion