Common administrative commands in Red Hat Enterprise Linux 5, 6, 7, and 8

Updated -

System basics

Task RHEL5 RHEL6 RHEL7 RHEL8
View subscription information /etc/sysconfig/rhn/systemid /etc/sysconfig/rhn/systemid
subscription-manager identity
subscription-manager identity
Configure subscription rhn_register1 rhn_register
rhnreg_ks
subscription-manager
subscription-manager2

rhn_register 3
View RHEL version information /etc/redhat-release
View system profile sosreport

dmidecode
hwbrowser
sosreport

dmidecode

lstopo
lscpu
sosreport
dmidecode

lstopo
lscpu
cat /proc/cpuinfo
lshw

Basic configuration

Task RHEL5 RHEL6 RHEL7 RHEL8
Graphical configuration tools system-config-* gnome-control-center
Text-based configuration tools system-config-*-tui
Configure printer system-config-printer gnome-control-center
Configure network system-config-network nmcli
nmtui
nm-connection-editor
nmcli
nmtui
nm-connection-editor
gnome-control-center
Configure system language system-config-language localectl localectl
gnome-control-center
Configure time and date system-config-date
date
timedatectl
date
timedatectl
date

gnome-control-center
Synchronize time and date ntpdate
/etc/ntp.conf
timedatectl
/etc/chrony.conf
ntpdate
timedatectl
date
/etc/chrony.conf
chronyc
Configure keyboard system-config-keyboard localectl localectl
gnome-control-center
Configure SSH /etc/ssh/ssh_config
/etc/ssh/sshd_config
~/.ssh/config
ssh-keygen

Jobs and services

Task RHEL5 RHEL6 RHEL7 RHEL8
List all services 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"
List running services service --status-all systemctl -t service --state=active
Start/stop service service name start
service name stop
systemctl start name.service
systemctl stop name.service
Enable/disable service chkconfig name on
chkconfig name off
systemctl enable name.service
systemctl disable name.service
View service status service name status systemctl status name.service
Check if service is enabled chkconfig name --list systemctl is-enabled name
Create new service file or modify configuration chkconfig --add systemctl daemon-reload
/etc/systemd/system/*.service
View run level/target runlevel
who -r
systemctl get-default
who -r
Change run level/target /etc/inittab
init run_level
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
View logs /var/log /var/log
journalctl
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
tlog
View audit output aureport
/var/log/faillog
Schedule/batch tasks cron
at
batch
cron
at
batch
systemd-run --on-calendar
Find file by name locate
Find file by characteristic find
Create archive tar
cpio
zip
xz

Kernel, boot, and hardware

Task RHEL5 RHEL6 RHEL7 RHEL8
Single user/rescue mode 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
Shut down system shutdown
Power off system poweroff poweroff
systemctl poweroff
Halt system halt halt
systemctl halt
Reboot system reboot reboot
systemctl reboot
Configure default run level/target /etc/inittab systemctl set-default
Configure GRUB bootloader /boot/grub/grub.conf /etc/default/grub
grub2-mkconfig
grub-set-default
Configure kernel module modprobe
View hardware configured hwbrowser lshw (in EPEL) lshw
Configure hardware device udev
View kernel parameters sysctl -a
cat /proc/cmdline
Load kernel module modprobe
Remove kernel module modprobe -r
View kernel version rpm -q kernel
uname -r

Software management

Task RHEL5 RHEL6 RHEL7 RHEL8
Install software yum install
yum groupinstall
yum install
yum group install
View software info yum info
yum groupinfo
yum info
yum group info
Update software yum update
Upgrade software yum upgrade
Configure software repository subscription-manager repos
/etc/yum.repos.d/*.repo
Find package owning file rpm -qf filename
yum provides filename-glob
View software version rpm -q packagename yum list installed packagename
rpm -q packagename
View installed software rpm -qa
yum list installed
Install a module yum module install module_name
View info on a module yum module info module_name
View a module's streams yum module info module_name
Change module streams yum module remove module_name:stream
yum module reset module:stream
yum module install module:new_stream
List available modules yum module list

User management

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

File systems, volumes, and disks

Task RHEL5 RHEL6 RHEL7 RHEL8
Default file system ext3 ext4 xfs
Create/modify disk partitions fdisk

parted
fdisk
gdisk

parted
ssm create
parted
fdisk
gdisk
ssm_create
Format disk partition mkfs.filesystem_type (ext4, xfs)
mkswap
mkfs.filesystem_type (ext4, xfs)
mkswap
ssm create
Defragment disk space copy data to new file system
fsck (look for 'non-contiguous inodes')
copy data to new file system
fsck (look for 'non-contiguous inodes')
xfs_fsr
Mount storage mount

/etc/fstab
mount

/etc/fstab
ssm mount
Mount and activate swap /etc/fstab

swapon -a
Configure static mounts /etc/fstab
View free disk space df
View logical volume info lvdisplay
lvs
vgdisplay
vgs
pvdisplay
pvs
Create physical volume pvcreate pvcreate
ssm create (if backend is lvm)
Create volume group vgcreate vgcreate
ssm create (if backend is lvm)
Create logical volume lvcreate lvcreate
ssm create (if backend is lvm)
Enlarge volumes formatted with default file system vgextend
lvextend
resize2fs
vgextend
lvextend
xfs_growfs
ssm resize
Shrink volumes formatted with default file system resize2fs
lvreduce
vgreduce
XFS cannot currently be shrunk; copy desired data to a smaller file system.
Check/repair file system fsck fsck
ssm check
View NFS share showmount -e
mount
Configure NFS share /etc/exports
service nfs reload
/etc/exports
systemctl reload nfs.service
Configure on-demand auto-mounts /etc/auto.master.d/*.autofs
/etc/auto.*
Change file permissions chmod
chown
chgrp
umask (future file creation)
Change file attributes chattr
Change access control list setfacl

Networking

Task RHEL5 RHEL6 RHEL7 RHEL8
Configure name resolution /etc/hosts
/etc/resolv.conf
/etc/hosts
/etc/resolv.conf
nmcli con mod
Configure hostname /etc/sysconfig/network hostnamectl
/etc/hostname
nmtui
View network interface info ip addr

ifconfig
brctl
ip addr
nmcli dev show
teamdctl
brctl
bridge
Configure network interface /etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/ifcfg-*
nmcli con [add|mod|edit]
nmtui
nm-connection-editor
View routes ip route
Configure routes ip route add
system-config-network
/etc/sysconfig/route-iface
ip route add
nmcli
nmtui
nm-connection-editor
/etc/sysconfig/route-iface
Configure firewall iptables and ip6tables
/etc/sysconfig/ip*tables
iptables and ip6tables
/etc/sysconfig/ip*tables
system-config-firewall
firewall-cmd
firewall-config
firewall-cmd
firewall-config
nftables
View ports/sockets ss
lsof
netstat
ss
lsof
netstat
ss
lsof
netstat
pcp-dstat --socket

Security and identity

Task RHEL5 RHEL6 RHEL7 RHEL8
Configure system security /etc/selinux/config
chcon
restorecon
semanage
setsebool
system-config-selinux
Report on system security sealert
LDAP, SSSD, Kerberos authconfig
authconfig-tui
authconfig-gtk
authselect
Network users getent

Resource management

Task RHEL5 RHEL6 RHEL7 RHEL8
Trace system calls strace
Trace library calls ltrace
Change process priority nice
renice
Change process run location taskset
Kill a process 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
ss
vmstat
mpstat
numastat
tuna
pcp atop
top
ps
sar
iostat
ss
vmstat
mpstat
numastat
tuna
View disk usage df df
iostat
pcp-dstat
pmiostat
df
iostat
  1. Be aware of potential issues when using subscription-manager on Red Hat Enterprise Linux 5: https://access.redhat.com/solutions/129003.

  2. subscription-manager is used for Satellite 6, Satellite 5.6 with SAM and newer, and Red Hat's CDN.

  3. RHN tools are deprecated on Red Hat Enterprise Linux 7. rhn_register should be used for Satellite server 5.6 and newer only. For details, see: What's the difference between management services provided by Red Hat Network (RHN) Classic and Red Hat Customer Portal Subscription Management/RHSM?, Transition of Red Hat Network Classic Hosted to Red Hat Subscription Management, and Satellite 5.6 unable to register RHEL 7 client system due to rhn-setup package not included in Minimal installation.

Attachments

12 Comments

https://access.redhat.com/node/1189123/40/5/14016981 Looks pretty and includes RHEL 8

I'm sorry about the broken links. I've just completed an update that may have addressed the issue. If this doesn't resolve it, please comment again so that I can troubleshoot further.

Hi Marci,

Thanks for your response. The links still are broken. Here an example for the A4 version, it opens the site
https://access.redhat.com/sites/default/files/attachments/rhel_5_6_7_cheatsheet_24x36_0417_jcs.pdf ...

Regards,
Christian

I have tested something Marci - when I right-click the link, select "Copy link location", open a new tab and
paste it in there, then it opens the correct new site. If I click on the link directly, it opens the older version.

Regards,
Christian

I've had a couple other people test links and so far they're all getting the updated posters. Is it possible that it's a cache issue? Could you try clearing your cache and testing the links again?

Possibly that might have been the problem, Marci ... :)
I've tested it again today and now it works as expected.

Regards,
Christian

Could you add container management section to this doc? docker vs podman, skopeo, buildah

Hi Robert,

I think that would better be realized in an extra container tools cheat sheet.
Meanwhile : https://developers.redhat.com/cheat-sheets/podman-basics :)

Regards,
Christian

I recently migrated Oralce database servers from RHEL 6.5 on vSphere 5.5 to RHEL 7.6 on vSphere 6.5 and was bitten by new VM not having "disk.EnabledUUID true" setting as none of my UDEV commands were working as expected.

What follows is differences between RHEL5/6 and RHEL 7/8 that I wish were documented on this checklist before I started.

<html>
<head><title>Supported Update to RH checklist (https://access.redhat.com/articles/1189123)</title></head>
<body>
<h1>RH CHECKLIST SUGGESTION FOR SCSI DEVICES AND UDEV( https://access.redhat.com/articles/1189123 )</h1>
<h2>Suggestion - expand configure hardware to show RH udev differences</h2>
<table border=2>
    <tr><td colspan="5"><B>REPLACE/EXPAND THE FOLLOWING:</B></td></tr>
    <tr>
    <th>Task</th>
    <th>RHEL5</th>
    <th>RHEL6</th>
    <th>RHEL7</th>
    <th>RHEL8</th>
    </tr>
    <tr>
    <td>Configure hardware device</td>
    <td colspan="5">udev</td>
    </tr>
    <tr><td colspan="5">&nbsp;</td></tr>
    <tr><td colspan="5"><B>SO UDEV WORKS FOR SCSI-SPECIFIC UDEV situations (for Databases, etc):</B></td></tr>
    <tr>
    <th>Task</th>
    <th>RHEL5</th>
    <th>RHEL6</th>
    <th>RHEL7</th>
    <th>RHEL8</th>
    </tr>
    <td>Configure hardware device</td>
    <td colspan="5">udev</td>
    </tr>
    <tr>
    <td>Identify SCSI hardware device</td>
    <td colspan="2">lsscsi<br>/sbin/scsi_id -g -u -d $dsk<br><b>for dsk in `ls -l /dev/sd[a-z]* | awk ' {print $10 } '`; do sid=`scsi_id -gud $dsk`; size=`fdisk -l $dsk | grep 'Disk /dev/sd' | awk ' { print $3 }'`; echo $dsk $sid $size; done</b></td>
    <td colspan="2">lsscsi<br>/usr/lib/udev/scsi_id -gud $dsk<br><b>for dsk in `ls -l /dev/sd[a-z]* | awk ' {print $10 } '`; do sid=`/usr/lib/udev/scsi_id -gud $dsk`; size=`fdisk -l $dsk | grep 'Disk /dev/sd' | awk ' { print $3 }'`; echo $dsk $sid $size; done</b></td>
    </tr>
    <tr>
    <td>Configure SCSI hardware device</td>
    <td colspan="2">udev<br>/etc/udev/rules.d<br><b>/sbin/scsi_id</b> -g -u -d $dsk<br>udevadm control --reload-rules<br><b>start_udev</b></td>
    <td colspan="2">udev<br>/etc/udev/rules.d<br><b>/usr/lib/udev/scsi_id</b> -gud $dsk<br>udevadm control --reload-rules<br><b>udevadm trigger --type=devices --action=change</b></td>
    </tr>
    <tr><td colspan="5">&nbsp;</td></tr>
    <tr><td colspan="5">Note:  For each RHEL, research proper use of KERNEL and SYMLINK in actual udev rule file (<a href="mailto:larry.timmins@gmail.com">LJT</A>)</td></tr>
    <tr><td colspan="5">Note2: Thanks for comment with link re: containers: https://developers.redhat.com/cheat-sheets/podman-basics </td></tr>
</table>
</body>
</html>

Sorry in advanced if this comment is off topic (i.e. the helpful cross-version checklist).

SUGGESTION: Copy and paste the code between the opening and closing HTML tags into local text editor, save to udev-scsi.html and open in favorite browser to see proper formatting.

After submitting this as ~~~ code ~~~ I reviewed the helpful tips on Markup. If this is important for translations, etc, I can change the above code page to MARKDOWN, but rather answer questions instead on making udev work for Oracle or the required PowerCli used to check and then set the disks.enabledUUID to true -- which until I figured that out, I had no unique ids being shown by any of the classic commands (lsscsi, etc) in trying to match udev rules with wildcard /dev/sd?1 to the /dev/ADM/asm-INSTANCE-P-1, etc names I wanted to use based on how VMware Hard Disks were assigned.

LJT

Hello Red Hat

seems like "pcp-dstat" command is wrong.

I am able to get output using "pcp dstat" command.

Could you please confirm it?

Gracias, great learning tools!1

Pages