You are on page 1of 5

RED HAT ENTERISE LINUX 5, 6, AND 7

Common administrative commands


1 Be aware of potential issues when using subscription-manager
SYSTEM BASICS on Red Hat Enterprise Linux 5: https://access.redhat.com/
solutions/129003.
TASK RHEL 2 Subscription-manager is used for Satellite 6, Satellite 5.6 with
SAM and newer, and Red Hat’s CDN.
/etc/sysconfig/rhn/systemid 5
3 RHN tools are deprecated on Red Hat Enterprise Linux 7.
/etc/sysconfig/rhn/systemid rhn_register should be used for Satellite server 5.6 and newer
View subscription information 6 only. For details, see: Satellite 5.6 unable to register RHEL 7
subscription-manager identity
client system due to rhn-setup package not included in
Minimal installation (https://access.redhat.com/
subscription-manager identity 7
solutions/737373)
rhn_register
5
subscription-manager 1

rhn_register
Configure subscription rhnreg_ks 6
subscription-manager

subscription-manager 2
7
rhn_register 3

sosreport
dmidecode 5
hwbrowser

View system profile sosreport


dmidecode RESOURCE MANAGEMENT
6 7
lstopo TASK RHEL
lscpu
top
View RHEL version information /etc/redhat-release 5 6 7 ps
sar
iostat
netstat 5
vmstat
BASIC CONFIGURATION mpstat
numastat
TASK RHEL
top
system-config-* 5 6 ps
Graphical configuration tools sar
gnome-control-center 7 iostat
netstat
6
system-config-network 5 6 View system usage ss
vmstat
Configure network nmcli mpstat
nmtui 7 numastat
nm-connection-editor tuna

system-config-language 5 6 top
Configure system language ps
localectl 7 sar
iostat
system-config-date ss 7
5 6 vmstat
date
Configure time and date mpstat
timedatectl numastat
7 tuna
date
df 5
ntpdate
5 6
/etc/ntp.conf View disk usage df
iostat 6 7
Synchronize time and date timedatectl
/etc/chrony.conf 7 Trace system calls strace 5 6 7
ntpdate
Trace library calls ltrace 5 6 7
system-config-keyboard 5 6
Configure keyboard
localectl 7 Change process nice
renice 5 6 7
priority
Text-based configuration tools system-config-*-tui 5 6 7
Change process taskset
Configure printer system-config-printer 5 6 7
run location
5 6 7

/etc/ssh/ssh_config
kill
Configure SSH /etc/ssh/sshd_config 5 6 7 Kill a process pkill 5 6 7
~/.ssh/config ssh-keygen killall
SOFTWARE MANAGEMENT NETWORKING
TASK RHEL TASK RHEL

yum install iptables and ip6tables


5 6 5
yum groupinstall /etc/sysconfig/ip*tables
Install software iptables and ip6tables
yum install Configure
7 /etc/sysconfig/ip*tables 6
yum group install firewall system-config-firewall

yum info firewall-cmd


5 6 7
yum groupinfo firewall-config
View software
info yum info /etc/hosts
7 5 6
Configure /etc/resolv.conf
yum group info
name /etc/hosts
Update software yum update 5 6 7 resolution /etc/resolv.conf 7
nmcli con mod
Upgrade software yum upgrade 5 6 7
/etc/sysconfig/network 5 6

Configure Configure hostnamectl


subscription-manager repos hostname
software 5 6 7 /etc/hostname 7
/etc/yum.repos.d/*.repo
repository nmtui

ip addr
Find file in rpm -qf filename
5 6 7 ifconfig 5 6
package yum provides filename-glob brctl
View network ip addr
View software rpm -q packagename 5 6 7 interface info nmcli dev show
version teamdctl 7
brctl
View installed rpm -qa
5 6 7 bridge
software yum list installed
/etc/sysconfig/network-scripts/ifcfg-* 5 6
Configure /etc/sysconfig/network-scripts/ifcfg-*
network nmcli con [add|mod|edit]
interface 7
nmtui
USER MANAGEMENT nm-connection-editor
TASK RHEL ss
lsof 5 6
Graphical user system-config-users 5 6 7 View ports/ netstat
management sockets
ss
7
lsof
Create user useradd 5 6 7
account ip route add
system-config-network 5 6
Delete user userdel 5 6 7 /etc/sysconfig/route-iface
account Configure ip route add
routes nmcli
usermod
nmtui 7
View/change user /etc/passwd
5 6 7 nm-connection-editor
account details vipw
/etc/sysconfig/route-iface
id
View routes ip route 5 6 7
Create user group groupadd 5 6 7

Delete user group groupdel 5 6 7

Change group groupmod


SECURITY AND IDENTITY
5 6 7
details /etc/group TASK RHEL

Change user passwd 5 6 7


/etc/selinux/config
password chcon
Configure system restorecon
5 6 7
Change user usermod security semanage
5 6 7 setsebool
permissions visudo
system-config-selinux

Change group groupmod


5 6 7 Report on system 5 6 7
permissions visudo sealert
security
Change password chage 5 6 7 authconfig
policy LDAP, SSSD, authconfig-tui 5 6 7
Kerberos authconfig-gtk
View user w 5 6 7
sessions Network users getent 5 6 7
JOBS AND SERVICES
TASK RHEL

/etc/syslog.conf 5

/etc/rsyslog.conf 6

Configure logging /etc/rsyslog.conf


/etc/rsyslog.d/*.conf
7
/var/log/journal
systemd-journald.service

chkconfig --list
5 6
ls /etc/init.d/
List all services systemctl -at service
ls /etc/systemd/system/*.service 7
ls /usr/lib/systemd/system/*.service

service --status-all 5 6
List running services
systemctl -t service --state=active 7

service name start


5 6
service name stop
Start/stop service
systemctl start name.service
7
systemctl stop name.service

chkconfig name on
5 6
chkconfig name off
Enable/disable service
systemctl enable name.service
7
systemctl disable name.service

service name status 5 6


View service status
systemctl status name.service 7

chkconfig name --list 5 6


Check if service is enabled
systemctl is-enabled name 7

chkconfig --add 5 6
Create new service file or modify
configuration systemctl daemon-reload
7
/etc/systemd/system/*.service

runlevel
5 6
who -r
View run level/target
systemctl get-default
7
who -r

/etc/inittab
5 6
init run_level
Change run level/target
systemctl isolate name.target
7
systemctl set-default

/var/log 5 6
View logs /var/log
7
journalctl

add audit=1 to kernel cmdline


auditctl
/etc/audit/auditd.conf
Configure system audit /etc/audit/audit.rules 5 6 7
authconfig
/etc/pam.d/system-auth
pam_tty_audit kernel module

View audit output aureport /var/log/faillog 5 6 7

cron
Schedule/batch tasks at 5 6 7
batch

Find file by name locate 5 6 7

Find file by characteristic find 5 6 7

tar
Create archive cpio 5 6 7
zip
FILE SYSTEMS, VOLUMES, AND DISKS
TASK RHEL

ext3 5

Default file system ext4 6

xfs 7

copy data to new file system


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

fdisk
5 6
parted

Create/modify disk partitions fdisk


gdisk
7
parted
ssm create

mkfs.filesystem_type (ext4, xfs)


5 6
mkswap
Format disk partition mkfs.filesystem_type (ext4, xfs)
mkswap 7
ssm create

mount
5 6
/etc/fstab
Mount storage mount
/etc/fstab 7
ssm mount

pvcreate 5 6
Create physical volume pvcreate
7
ssm create (if backend is lvm)

vgcreate 5 6
Create volume group vgcreate
7
ssm create (if backend is lvm)

lvcreate 5 6
Create logical volume lvcreate
7
ssm create (if backend is lvm)

vgextend
lvextend 5 6
resize2fs
Enlarge volumes formatted with
default file system vgextend
lvextend
7
xfs_growfs
ssm resize

resize2fs
lvreduce 5 6
Shrink volumes formatted with vgreduce
default file system
XFS cannot currently be shrunk; copy desired data to
7
a smaller file system.

fsck 5 6
Check/repair file system fsck
7
ssm check

/etc/exports
5 6
service nfs reload
Configure NFS share
/etc/exports
7
systemctl reload nfs.service

/etc/fstab
Mount and activate swap 5 6 7
swapon -a

Configure static mounts /etc/fstab 5 6 7

View free disk space df 5 6 7


FILE SYSTEMS, VOLUMES, AND DISKS (CONT.)
TASK RHEL

lvdisplay
lvs
vgdisplay
View logical volume info 5 6 7
vgs
pvdisplay
pvs

showmount -e
View NFS share 5 6 7
mount

/etc/auto.master.d/*.autofs
Configure on-demand auto-mounts 5 6 7
/etc/auto.*

chmod
chown
Change file permissions 5 6 7
chgrp
umask (future file creation)

Change file attributes chattr 5 6 7

Change access control list setfacl 5 6 7

KERNEL, BOOT, AND HARDWARE


TASK RHEL

append 1 or s or init=/bin/bash to kernel cmdline 5 6


Single user/rescue mode
append rd.break or init=/bin/bash to kernel cmdline 7

Shut down system shutdown 5 6

poweroff 5 6
Power off system poweroff
7
systemctl poweroff

halt 5 6
Halt system halt
7
systemctl halt

reboot 5 6
Reboot system reboot
7
systemctl reboot

/etc/inittab 5 6
Configure default run level/target
systemctl set-default 7

/boot/grub/grub.conf 5 6

Configure GRUB bootloader /etc/default/grub


grub2-mkconfig 7
grub-set-default

hwbrowser 5
View hardware configured
lshw (in EPEL) 6 7

Configure kernel module modprobe 5 6 7

Configure hardware device udev 5 6 7

sysctl -a
View kernel parameters cat /proc/cmdline
5 6 7

Load kernel module modprobe 5 6 7

Remove kernel module modprobe -r 5 6 7

rpm -q kernel
View kernel version uname -r
5 6 7

04/17

Copyright © 2017 Red Hat, Inc. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, and JBoss are trademarks of Red Hat, Inc.,
registered in the U.S. and other countries. Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

You might also like