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

Table of Contents

No

72 Comments

A quick update to let you all know that a printable poster of these commands is now available under Attachments.

Ms. Bailey,

Does the copyright on the poster allow the .pdf to be distributed? When I transition to 7 I'm going to hang copies in my computer labs, but knowing the students they're going to ask for copies of the file.

David Winters

Hi David, unfortunately the copyright does not allow that, but let me see what I can wrangle for you.

Hello,

Any update, what are the license of theses documents (page and pdf)

Can i hand out copy of them ?

Can i use them for teaching purpose ?

Thanks for the feedback

Hi Thomas, at present the license does not allow copying or use for teaching purposes, as this is available only to subscribers. I've passed on the request, though, so please stay tuned.

Hi Thomas, just letting you know that we've made this publicly available -- so, while you still can't technically copy it for teaching purposes, you can certainly link your students to this page, and they should be able to see it now that a subscription is not required. Hope this helps!

Very helpful for me. Liked the poster, too. Thanks!

Why lot many differences in RHEL7 ?
i like to study it soon

Thanks for the document, very helpful for my team.

Thanks for putting this together. Very useful. Thanks for sharing.

Thanks for this, always great having a quick reference guide!

Any chance of the printable document being in a 2 page format? Unless you have an A2 printer its a little small to read.

One of our graphic designers is working on some more compact versions as I type; I'll see what we can wrangle.

Many thanks. The exact same format would be perfect, just in 2 pages it then fits perfectly on 2x a3 pages.

Hi Warren, our graphic designer is still working on a split-page version, but I wanted to let you know that the poster has been updated and should now be a little easier to read on a single A3 page. It should also split a little more nicely over two pages if you do need it larger. :) I'll let you know when a multi-page option is available.

Hi Warren, just letting you know that there's a multi-page version available now — it was designed for A3, but it'll still work just fine at A4. :)

Lot of Changes in RHEL7 Commands . Need to go through the referance guide and start learn it right now

Thanks for the Great reference sheet

thank you very much!
scared about RHEL7!

helpfull to bootstrap RHEL 7, thanks

Wow, that's a lot of changes. Anybody ever consider that if you need to create a knowledgebase article and a reference poster to go from one version of RHEL to another that you may be changing too many things too drastically? That's when stable and dependable products become unreliable.

These are not all changes which Red Hat pushed. Keep in mind: when you use any Linux distribution, you're benefiting from countless man hours of work contributed by countless members of various communities. We at Red Hat would not be able to make RHEL on our own; it's made up of hundreds and hundreds of projects which, over time, evolve and change.

I understand that a lot of these changes came from upstream, but surely Red Hat has a lot of clout in the community to nudge the direction of things at least. There are still a few distributions going their own way when the upstream changes are unpopular with their communities, and Red Hat is in a unique position with more resources than many of these. For one example, look to the very short-lived existence of upstart. I'm not sure what happened behind the scenes there, but Red Hat's implementation was very non-intrusive and wholly backwards compatible with SysV init to the extent that you could run a RHEL server and not even realize that upstart was there. Now it's been tossed to the side as quickly as it appeared.

From what I've seen/heard of 8, I'm questioning if Red Hat has lost the script. It's been my preferred enterprise distro for years because it did what it does very well with rock solid dependability and a core focus. Maybe its time to split into a few products and introduce a RHEL Classic with all the flavour your remember from way back when.

I hear you John. While I wasn't in a position to make any decisions regarding RHEL7, I have been using Fedora on my personal systems for years and years so none of these changes came as a shock to me; however, I have many colleagues (sysadmins or not) who have expressed similar feelings about RHEL7.

As a sysadmin, support tech, and teacher-trainer, I'm always focused on learning new things -- grow or die, IMHO -- but I know many people just want to get on with their jobs and their lives. That said, in dealing with my colleagues, so far, not one of them has held on to their scepticism about a particular RHEL7 component (e.g., systemd, firewalld, grub2, new-anaconda, targetcli, NetworkManager) once they've actually taken the time to learn about the how/what/why of it.

Of course the natural response to my statement might be "but we don't want/have the time!" ... To which I can only say: RHEL6 isn't going anywhere.

PS regarding upstart in RHEL6: I can see why you'd say that Red Hat's implementation was non-intrusive -- after all we kept the whole SysV init rc structure completely intact! Keep in mind however that in doing so we didn't take advantage of any of the job-control or event-based parallelization features upstart had to offer. It was great that most people didn't have to learn anything new, but most people also didn't notice any improvement over init from RHEL5.

...and this is a handy chart/poster. I'm just amazed that it's necessary.

Thank you for your efforts --

However, it is a absurd waste of systems administrators time to learn all new commands to do same-old same-old tasks. Clearly Red Hat leadership in User Experience is absent for those customers committed to managing Red Hat environments. For this effort, does it mean RHEL 7 will deliver 400% productivity improvement? Otherwise, it will delay moves to RHEL 7 or changes in platforms.

On the plus side, this documentation -- both in this format and the PDF poster size was done very weel. It certainly will allow anyone who uses their own automation scripts and tools to discover the command line equivalents quickly and update their scripts to avoid the very commands being replaced and their new replacements.

P.S. The 27" x 36" = 7 sq foot and depending on the FedEx/Kinko's will cost $5.25 to print out ($0.75/sq foot).

Far too many command changes in RHEL 7. Its very annoying. i.e ifconfig doesn't exist.
For 20 years I have been using ifconfg. why change it.

Its very very annoying.

For the record, ifconfig is still fully-available in RHEL7 (What happened to ifconfig in RHEL 7?); however, it was deprecated years ago (in the the RHEL5 days) in favor of ip. Feel free to keep using ifconfig until it no longer works for you (e.g., until you have a system whose interfaces have multiple non-alias IP addresses, which ifconfig has never been able to see).

Thank you for this very well documented quick cheat sheet, it is really appreciated. It will be handy soon when we are to go to RHEL 7.

I have a request however, would it be possible to have this document also in a printable format, the way it currently is showing here above, but one that can actually download so that it would be easily referred to when we do not have access to the web? The printable poster version is really nice as well, but our multi-function printer can only support up to 11" x 17" and even at that size the print is really small to read!

Thank you again, it is really appreciated.

Hi Elie, our graphic designer is looking into a 2-3 page version that could be printed on more common paper sizes; I'll update this article when it becomes available.

Thank you very much Laura for looking into this for us, it is really appreciated.

Hi Elie, just letting you know that Jess Schaefer has updated the poster so that it doesn't require quite as much space.Let us know what you think!

Thank you Laura and Jess for updating the poster, it looks great, and I was able to successfully print it on 8.5" x 11" paper without a problem.

Thank you again for all your help with this, this document will be very handy going on to RHEL 7.

Hi Elie, just checking back to let you know that the multi-page version of the 'poster' is now available. Let us know what you think!

Thank you Laura, it looks great, it is really appreciated.

Hi Laura,
Thanks for providing the updated version. I was able to print the A3 version using 'Fit' option from Adobe Acrobat to normal 8.5 x 11 paper.

While there is certainly a need for A4, A3 and other metric standards, why isn't there an equal need for Red Hat to provide a standard US Letter and/or US Legal format?

The tough thing about Excellence is thinking it through and getting it right.

That's a good point, Larry. We can probably resize the A3 poster so that it's good to print on both A3 and US Tabloid (11x17), and can scale down nicely for A4 and US Letter/Legal. Let me check with Jess on that and I'll get back to you.

Very Nice document, helpful in quickly understand & learning.

Thank you.

A print this page button would be awesome, so that we can get a nicely formatted view of this.

There is an attached printable poster in PDF format which is good enough as a reminder.

Agreed; I've come across this as a useful addition a few times. I'll talk to the Portal team about it.

Just letting you know that there's now a multi-page version of the 'poster', so you can download and print a nicely formatted version at home. This should work nicely on A3 and A4.

Users should not edit /etc/sudoers directly! They should run visudo instead.
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Security_Guide/chap-Security_Guide-General_Principles_of_Information_Security.html

Good point, thanks for the catch.

The attached PDF poster has not been updated about visudo usage.

Updates on the PDF will be a few days behind updates to the article itself, but should be on their way shortly.

Good morning Laura,
Thanks for taking the time and being responsive to input to make the multiple PDF versions. The initial investment to making each format will have so many of us OCD types from re-formatting the same material to a locally useable size before we can even review it 8^) Seriously, I made a suggestion and thank you and the Red Hat team for taking such a helpful document and putting into a format everyone can use and focus on right away (to her or his liking).

Glad to help, Larry. :) Most of the credit here goes to our fabulous designer Jess Schaefer.

Mike, Alessandro, the poster has been updated with visudo instead of /etc/sudoers now; thanks again for the catch on this.

Thanks, Laura!

Thanks Laura. This is helpful.

Many commands are missed in RHEL6?

Hi Nilaj,

If there are any commands you want added, just let me know, and I'll see about getting them added.

I think you might be talking about the commands that are the same in RHEL 5 and RHEL 6, though — the current Portal style doesn't include vertical table dividers. I have a bug raised to help with this, but in the mean time, check out the downloadable PDF files — I think these are much clearer at the moment.

Cheers,
Laura B

Hi Laura,

I don't know if you are still getting these comments, but I would like to way in. Thanks for the posters by the way. They are very helpful. I've been using Fedora as a desktop since Fedora 12 and liked it from the start. I've also used RHEL4 and up in production environments over the years. Both OSes have some interesting features and I know that that there are a lot of software contributors to their development.

When you start to taking things from a desktop OS and implementing them on a server OS, you might be asking for trouble. Microsoft found out the hard way (ie., Start Menu) that wasn't the best idea. In my experience a desktop OS and server OS should not be mixed.
A server has one purpose....To serve.... It is not a desktop.

I know that things need to change, but changing things just because somebody didn't like the way it was in RHEL5/6 for the sake of change to me doesn't make sense. You mentioned in a previous post that things need to evolve. I agree, but part of evolution is learning that somethings don't work and aren't as efficient as some might think. I know that RHEL7 is still an infant yet and still has some maturing to do.

Cheers,

Hi Doug,

Glad you're finding the posters useful. I think the comment on evolution was actually from another Red Hatter, but to your point: I agree! For a change to stick, it needs to be useful to the rest of the 'organism' — or in this case, its users.

Is there anything you're finding particularly difficult (or nonsensical) to adjust to?

Cheers,
Laura B

The command 'grub-set-default' does not exist in RHEL7. The proper command should be 'grub2-set-default'.

All the possible resources for sys admin can be found under RH's documentation or in the knowledgebase, but we could use a directory w/ quick links for the pdf's. But mostly the whole documentation is sooooo nifty!

Is it mandatory to evaluate the OS versions for using knowledgebase? Anyone has any idea of a RH archive with technical documentation?

Tnx all!

Until RH gets a coherent administrative tool like YAST then this is absolutely necessary. Thanks. Hopefully for not much longer.

Hello,

In the attachment "rhel_5_6_7_cheatsheet_a4_1114_jcs.pdf" on the last page is the command "systemctl shutdown" mentioned for RHEL 7. But this command is not available in at least RHEL 7.2.

Maybe this error could be corrected.

Kind regards, Joerg

Jörg thanks for the note, good catch. We'll queue up a correction to show which versions of RHEL support the "poweroff" command.

This an awesome straight forward cheat sheet...

lshw package is also in rhel-7-server-rpms channel

Very informative and interesting

lshw is part of the rhel-7-server-rpms repository, you do not need EPEL anymore on RHEL 7.

Hi Laura,

Can we expect a printable poster ones RHEL 8 has become GA?

Regards,

Jan Gerrit

Hi Jan! I'm no longer on that docs team, but I know that they are aware of this and keen to get RHEL8 details added - not sure if it will happen for GA, though. I'll see if I can get someone from the team to respond with more information. :)

Just in case you're not getting updates on this document, the RHEL8 details have been added! Not sure when you can expect the printed posters but I'm sure they're in progress.

Hello Laura,
Thank you for the update.

A printable poster would be great. Hope it would be available when RHEL8 GA is going to be released.

Thanks,
Joerg

+1 for updating the attachments to include RHEL 8

Thanks for the attachments. Unfortunately the links are broken ... they point to the old version "rhel_5_6_7_cheatsheet_XXXXX_0417.pdf".

Pages