You are on page 1of 4

Common administrative commands

in Red Hat Enterprise Linux 5, 6, 7, and 8


System basics Basic configuration (cont.)
TASK RHEL TASK RHEL

View /etc/sysconfig/rhn/systemid 5 6 system-config-date 5 6


subscription Configure timedatectl 7 8
information subscription-manager identity 6 7 8
time and date date 5 6 7 8
rhnreg_ks 6 gnome-control-center 8
Configure 1, 3 5 6 7 8
subscription
rhn_register /etc/ntp.conf 5 6

subscription-manager 2 6 7 8 ntpdate 5 6 7
Synchronize timedatectl
hwbrowser 5 time and date 7 8
/etc/chrony.conf
sosreport
5 6 7 8 date
dmidecode 8
View system chronyc
profile lstopo
6 7 8
lscpu system-config-keyboard 5 6
Configure
localectl 7 8
cat/proc/cpuinfo
8 keyboard
lshw
gnome-control-center 8

View RHEL /etc/ssh/ssh_config


version /etc/redhat-release 5 6 7 8 Configure /etc/ssh/sshd_config
5 6 7 8
information SSH ~/.ssh/config
ssh-keygen

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. Resource management
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 TASK RHEL
subscription management services are offered by RHSM?, Transition of Red
Hat Network Classic Hosted to Red Hat Subscription Management, and Trace system
Satellite 5.6 unable to register RHEL 7 client system due to rhn-setup strace 5 6 7 8
calls
package not included in Minimal installation.

Trace library ltrace 5 6 7 8


calls

Basic configuration Change


nice
process renice 5 6 7 8
TASK RHEL priority

Graphical system-config-* 5 6
Change
configuration process run taskset 5 6 7 8
tools gnome-control-center 7 8
location

Text-based kill
configuration system-config-*-tui 5 6 Kill a process pkill 5 6 7 8
tools killall

netstat 5 6
Configure system-config-printer 5 6 7
printer ss
gnome-control-center 8 tuna 6 7 8

system-config-network 5 6 pcp atop 8


nmcli
View system
Configure usage top
nmtui 7 8
network nm-connection-editor
ps
sar
iostat 5 6 7 8
gnome-control-center 8
vmstat
system-config-language 5 6 mpstat
Configure numastat
system localectl 7 8
language iostat 6 7 8
gnome-control-center 8
View disk pcp-dstat
usage pmiostat 8

df 5 6 7 8
Jobs and services Jobs and services (cont.)
TASK RHEL TASK RHEL

chkconfig --list cron


5 6
ls /etc/init.d/ Schedule/ at 5 6 7 8
systemctl -at service batch tasks batch

ls /etc/systemd/system/*. systemd-run --on-calendar 8


service 7
List all ls /usr/lib/systemd/system/*. Find file by
services service name
locate 5 6 7 8

systemctl list-units -at


service Find file by
8
find 5 6 7 8
find /etc/systemd/ /usr/lib/ characteristic
systemd/ /run/systemd/ -name
*.service” tar
cpio
service --status-all 5 6 Create archive 5 6 7 8
List running zip
services systemctl -t service
7 8
xz
--state=active

service name start


5 6
Start/stop service name stop
service systemctl start name.service
User management
7 8
systemctl stop name.service TASK RHEL
chkconfig name on
5 6 5 6 7
Enable/ chkconfig name off Graphical user system-config-users

disable management
systemctl enable name.service gnome-control-center 8
service systemctl disable name. 7 8
service Create user useradd 5 6 7
account gnome-control-center 8
View service service name status 5 6
status systemctl status name.service 7 8 userdel 5 6 7
Delete user
chkconfig name --list 5 6
account 8
Check if gnome-control-center
service is
7 8 usermod
enabled systemctl is-enabled name
/etc/passwd
View/change 5 6 7
Create new chkconfig --add 5 6 user account vipw

service file details id

or modify systemctl daemon-reload


7 8 gnome-control-center 8
configuration /etc/systemd/system/*.service

Create user groupadd 5 6 7


runlevel 5 6
group
View run gnome-control-center 8
systemctl get-default 7 8
level/target
who -r 5 6 7 8 Delete user groupdel 5 6 7
group gnome-control-center 8
/etc/inittab
5 6
Change run init run_level
groupmod
level/target systemctl isolate name.target Change group 5 6 7
7 8 /etc/group
systemctl set-default details
gnome-control-center 8
/etc/syslog.conf 5

/etc/rsyslog.conf 6 7 8 Change user passwd 5 6 7


Configure
logging password gnome-control-center 8
/etc/rsyslog.d/*.conf
/var/log/journal 7 8
systemd-journald.service usermod
Change user 5 6 7
visudo
journalctl 7 8 permissions
View logs
/var/log 5 6 7 8
gnome-control-center 8

pam_tty_audit kernel module 5 6 7 Change chage 5 6 7


password
tlog 8
policy gnome-control-center 8
Configure add audit=1 to kernel cmdline
system audit auditctl
View user w 5 6 7
/etc/audit/auditd.conf
/etc/audit/audit.rules
5 6 7 8 sessions gnome-control-center 8
authconfig
/etc/pam.d/system-auth

View audit aureport


5 6 7
output /var/log/faillog
File systems, volumes, and disks File systems, volumes, and disks (cont.)
TASK RHEL TASK RHEL

ext3 5 service nfs reload 5 6


Default file Configure
system ext4 6 systemctl reload nfs.service 7 8
NFS share
xfs 7 8 /etc/exports 5 6 7 8
ssm create 7
Configure
7 8 /etc/auto.master.d/*.autofs
Create/ gdisk on-demand 8
/etc/auto.*
modify disk ssm_create 8 auto-mounts
partitions
fdisk chmod
5 6 7 8 Change file
parted chown
permissions chgrp 8
ssm create 7 8 umask (future file creation)
Format disk mkfs.filesystem_type (ext4,
partition xfs) 5 6 7 8 Change file chattr 8
mkswap attributes

xfs_fsr 6 7 8
Change
Defragment copy data to new file system access setfacl 8
disk space fsck (look for ‘non-contiguous 5 6 7 8 control list
inodes’)

ssm mount 7 8
Mount
storage mount
5 6 7 8
/etc/fstab
Networking
Mount and /etc/fstab TASK RHEL
5 6 7 8
activate swap swapon -a

Configure nmcli con mod 7 8


Configure name
/etc/fstab 5 6 7 8 /etc/hosts
static mounts resolution 5 6 7 8
/etc/resolv.conf

View free disk /etc/sysconfig/network 5 6


df 5 6 7 8
space Configure
hostnamectl
hostname /etc/hostname 7 8
lvdisplay
nmtui
lvs
View logical vgdisplay
5 6 7 8 ifconfig 5 6
volume info vgs
pvdisplay nmcli dev show
pvs View network teamdctl 7 8
interface info bridge
ssm create (if backend is
Create 8
lvm)
physical ip addr
5 6 7 8
volume brctl
pvcreate 5 6 7 8
nmcli con [add|mod|edit]
ssm create (if backend is 7 8
Create volume lvm) 8 Configure nmtui

group network nm-connection-editor


vgcreate 5 6 7 8 interface /etc/sysconfig/network-scripts/
5 6 7 8
ifcfg-*
ssm create (if backend is
Create logical lvm) 8
volume View routes ip route 5 6 7 8
lvcreate 5 6 7 8
system-config-network 5 6
resize2fs 5 6
Enlarge nmcli
volumes xfs_growfs Configure nmtui 7 8
formatted ssm resize 7 8 routes nm-connection-editor
with default
ip route add
file system vgextend
5 6 7 8 5 6 7 8
lvextend /etc/sysconfig/route-iface

resize2fs iptables and ip6tables


Shrink 5 6
lvreduce 5 6 /etc/sysconfig/ip*tables
volumes vgreduce
formatted Configure system-config-firewall 6
with default XFS cannot currently be
firewall
file system shrunk; copy desired data to 7 8 firewall-cmd
7 8
a smaller file system. firewall-config

ssm check 8 nftables 8


Check/repair
file system fsck 5 6 7 8 pcp-dstat--socket 8
View ports/
ss
View NFS showmount -e sockets 5 6 7 8
5 6 7 8 lsof
share mount
netstat
Software management Kernel, boot, and hardware (cont.)
TASK RHEL TASK RHEL

yum groupinstall 5 6 systemctl halt 7 8


Halt system
Install halt 5 6 7 8
yum group install 7 8
software
yum install 5 6 7 8 Reboot systemctl reboot 7 8
system
yum groupinfo 5 6
reboot 5 6 7 8

View software Configure /etc/inittab 5 6


yum group info 7 8
info default run
yum info 5 6 7 8 level/target systemctl set-default 7 8

Update Configure
/boot/grub/grub.conf 5 6
yum update 5 6 7 8
software GRUB /etc/default/grub
bootloader grub2-mkconfig 7 8
Upgrade grub-set-default
yum upgrade 5 6 7 8
software
hwbrowser 5
View hardware
Configure lshw (in EPEL) 6 7
subscription-manager repos configured
software 5 6 7 8
/etc/yum.repos.d/*.repo 8
repository lshw

Find package rpm -qf filename Configure modprobe 5 6 7 8


owning file yum provides filename-glob
5 6 7 8 kernel module

rpm -q packagename 5 6 Configure


View software hardware udev 5 6 7 8
version yum list installed packagename device
7 8
rpm -q packagename
View kernel sysctl -a
5 6 7 8
View installed rpm -qa parameters cat /proc/cmdline
5 6 7 8
software yum list installed
Load kernel modprobe 5 6 7 8
Install a module
yum module install module_name 8
module
Remove modprobe -r 5 6 7 8
View info on a kernel module
yum module info module_name 8
module
View kernel rpm -q kernel
5 6 7 8
View a version uname -r
module’s yum module info module_name 8
streams

yum module remove


Change module_name:stream Security and identity
module yum module reset module:stream 8
streams TASK RHEL
yum module install
module:new_stream /etc/selinux/config
Configure chcon
List available system restorecon
5 6 7 8
yum module list 8
modules security
semanage
setsebool
system-config-selinux

Report on
system sealert 5 6 7 8
Kernel, boot, and hardware security
TASK RHEL
authconfig
append 1 or s or init=/bin/ LDAP, SSSD, authconfig-tui 5 6 7
5 6 authconfig-gtk
bash to kernel cmdline Kerberos
Single user/
rescue mode append 1 or s or rd.break or authselect 8
init=/bin/bash to kernel 7 8
cmdline Network users getent 5 6 7 8

Shut down shutdown 5 6 7 8


system
Copyright © 2019 Red Hat, Inc. Red Hat, Red Hat Enterprise Linux, the Red Hat logo, and
Power off systemctl poweroff 7 8 JBoss are trademarks or registered trademarks of Red Hat, Inc. or its subsidiaries in the
United States and other countries. Linux ® is the registered trademark of Linus Torvalds in the
system U.S. and other countries.
poweroff 5 6 7 8
5/19

You might also like