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

System basics systems, volumes, and disks Jobs and services

TASK RHEL TASK RHEL TASK RHEL

/etc/sysconfig/rhn/ 5 chkconfig --list 5 6 5 6 View systemid Default file /etc/init.d/ subscription ext4 6 subscription-manager system systemctl - service information 6 7 8 identity 7 8 ls /etc/systemd/system/*. service 7 ssm create 7 rhnreg_ks 6 List all ls /usr/lib/systemd/ system/*.service Create/ gdisk 7 8 services Configure rhn_register 1, 3 5 6 7 8 modify disk systemctl list-units -at subscription ssm_create 8 partitions service subscription-manager 2 6 7 8 /etc/systemd/ / fdisk usr/lib/systemd/ / 8 parted 5 6 7 8 hwbrowser 5 run/systemd/ -name *.service” ssm create sosreport 7 8 5 6 7 8 dmidecode Format disk service --status-all 5 6 mkfs.filesystem_type (ext4, List running View system partition xfs) lstopo 5 6 7 8 systemctl -t service profile mkswap services lscpu 6 7 8 --state=active 7 8 xfs_fsr /proc/cpuinfo 6 7 8 service name start lshw 8 5 6 Defragment copy data to new file service name stop system Start/stop disk space systemctl start name. View RHEL (look for ‘non-contig- 5 6 7 8 service service version /etc/redhat-release 5 6 7 8 uous inodes’) 7 8 systemctl stop name. information ssm 7 8 service Mount chkconfig name on 1 Be aware of potential issues when using subscription-manager on Red storage mount 5 6 Hat Enterprise Linux 5: https://access.redhat.com/solutions/129003. /etc/fstab 5 6 7 8 chkconfig name off Enable/ 2 Subscription-manager is used for Satellite 6, Satellite 5.6 with SAM disable systemctl enable name. and newer, and Red Hat’s CDN. Mount and /etc/ 5 6 7 8 service service swapon -a 7 8 3 RHN tools are deprecated on Red Hat Enterprise Linux 7. rhn_register activate swap systemctl disable name. should be used for Satellite server 5.6 and newer only. For details, see: service What subscription management services are offered by RHSM?, Configure /etc/fstab Transition of Red Hat Network Classic Hosted to Red Hat Subscription static mounts 5 6 7 8 service name status 5 6 Management, and Satellite 5.6 unable to register RHEL 7 client system View service due to rhn-setup package not included in Minimal installation. status systemctl status name. service 7 8 View free disk space 5 6 7 8 Check if chkconfig name --list 5 6 lvdisplay service is lvs enabled systemctl is-enabled name 7 8 Software management View logical vgdisplay volume info vgs 5 6 7 8 TASK RHEL chkconfig --add 5 6 pvdisplay Create new pvs service file systemctl daemon-reload yum groupinstall 5 6 or modify /etc/systemd/system/*. 7 8 Install Create ssm create (if backend is configuration service yum group install 8 software 7 8 physical lvm) volume runlevel 5 6 yum install 5 6 7 8 pvcreate 5 6 7 8 View run systemctl get-default 7 8 yum groupinfo 5 6 ssm create (if backend is level/target Create volume lvm) 8 View software -r 5 6 7 8 yum group info 7 8 group info vgcreate 5 6 7 8 /etc/inittab 5 6 yum info 5 6 7 8 init run_level ssm create (if backend is Change run 8 Create logical lvm) level/target systemctl isolate name. Update volume yum update 5 6 7 8 target 7 8 software lvcreate 5 6 7 8 systemctl set-default

resize2fs 5 6 /etc/syslog.conf 5 Upgrade yum upgrade Enlarge software 5 6 7 8 volumes xfs_growfs Configure /etc/rsyslog.conf 6 7 8 formatted ssm resize 7 8 logging Configure subscription-manager with default /etc/rsyslog.d/*.conf vgextend /var/log/journal software repos 7 8 5 6 7 8 lvextend 5 6 7 8 systemd-journald.service repository /etc/yum.repos.d/*.repo resize2fs journalctl 7 8 Shrink Find package rpm -qf filename lvreduce 5 6 View logs 5 6 7 8 volumes vgreduce /var/log 5 6 7 8 owning file yum provides filename-glob formatted XFS cannot currently be pam_tty_audit kernel with default 5 6 7 rpm -q packagename 5 6 file system shrunk; copy desired data 7 8 module to a smaller file system. View software yum list installed tlog 8 version packagename 7 8 ssm check 8 Check/repair Configure add audit=1 to kernel rpm -q packagename file system fsck 5 6 7 8 system audit cmdline auditctl View installed rpm -qa /etc/audit/auditd.conf 5 6 7 8 showmount -e 5 6 7 8 View NFS /etc/audit/audit.rules software yum list installed mount 5 6 7 8 share authconfig /etc/pam.d/system-auth Install a yum module install service nfs reload 8 5 6 module module_name View audit aureport Configure systemctl reload nfs. output /var/log/faillog 5 6 7 NFS share service 7 8 View info on a yum module info 8 module module_name /etc/exports 5 6 7 8 Schedule/ at 5 6 7 8 batch /etc/auto.master.d/*. batch tasks View a yum module info Configure module’s 8 on-demand autofs 8 module_name systemd-run --on-calendar 8 streams auto-mounts /etc/auto.*

Find file by locate yum module remove name 5 6 7 8 module_name:stream Change file Change 8 yum module reset permissions Find file by module 8 (future file find 5 6 7 8 streams module:stream creation) characteristic yum module install module:new_stream tar Change file chattr 8 attributes Create archive 5 6 7 8 List available zip yum module list 8 xz modules Change access setfacl 8 control list Basic configuration Kernel, boot, and hardware Security and identity

TASK RHEL TASK RHEL TASK RHEL

Graphical system-config-* 5 6 append 1 or s or init=/ /etc/selinux/config configuration bin/bash to kernel 5 6 Configure chcon cmdline tools gnome-control-center 7 8 Single user/ system restorecon semanage 5 6 7 8 rescue mode append 1 or s or rd.break security setsebool or init=/bin/bash to Text-based 7 8 system-config-selinux kernel cmdline configuration system-config-*-tui 5 6 tools Report on Shut down shutdown 5 6 7 8 system sealert system 5 6 7 8 Configure system-config-printer 5 6 7 security printer systemctl poweroff 7 8 gnome-control-center 8 Power off authconfig system authconfig-tui 5 6 7 system-config-date 5 6 poweroff 5 6 7 8 LDAP, SSSD, authconfig-gtk Kerberos timedatectl 7 8 systemctl halt 7 8 Configure authselect 8 and date Halt system date 5 6 7 8 halt 5 6 7 8 Network users getent 5 6 7 8 gnome-control-center 8 Reboot systemctl reboot 7 8 /etc/ntp.conf 5 6 system reboot 5 6 7 8 ntpdate 5 6 7 Configure /etc/inittab 5 6 Synchronize timedatectl default run time and date 7 8 /etc/chrony.conf level/target systemctl set-default 7 8 User management

date TASK RHEL /boot/grub/grub.conf chronyc 8 Configure 5 6 system-config-users GRUB /etc/default/grub Graphical user 5 6 7 system-config-keyboard 5 6 bootloader grub2-mkconfig management 7 8 gnome-control-center Configure grub-set-default 8 localectl keyboard 7 8 hwbrowser 5 Create user useradd 5 6 7 gnome-control-center 8 View hardware account lshw (in EPEL) 6 7 gnome-control-center 8 /etc/ssh/ssh_config configured Configure /etc/ssh/sshd_config lshw 8 userdel 5 6 7 SSH ~/.ssh/config 5 6 7 8 Delete user ssh-keygen account Configure gnome-control-center 8 modprobe 5 6 7 8 kernel module usermod View/change /etc/passwd Configure 5 6 7 user account vipw hardware udev Networking 5 6 7 8 details id device TASK RHEL gnome-control-center 8 View kernel sysctl -a Configure nmcli con mod 7 8 parameters cat /proc/cmdline 5 6 7 8 Create user groupadd 5 6 7 name group /etc/hosts gnome-control-center 8 5 6 7 8 resolution /etc/resolv.conf Load kernel modprobe 5 6 7 8 module Delete user groupdel 5 6 7 /etc/sysconfig/network 5 6 group Configure gnome-control-center 8 hostnamectl Remove hostname modprobe -r 5 6 7 8 /etc/hostname 7 8 kernel module groupmod 5 6 7 nmtui Change group /etc/group View kernel rpm -q kernel details ifconfig 5 6 version -r 5 6 7 8 gnome-control-center 8

nmcli dev show passwd 5 6 7 View network teamdctl 7 8 Change user password interface info bridge gnome-control-center 8 ip addr 5 6 7 8 usermod brctl 5 6 7 Resource management Change user visudo permissions nmcli con [add|mod|edit] TASK RHEL Configure nmtui 7 8 gnome-control-center 8 -connection-editor network Trace system strace 5 6 7 8 Change chage 5 6 7 interface /etc/sysconfig/ calls 5 6 7 8 password network-scripts/ifcfg-* policy gnome-control-center 8 Trace library ltrace View routes ip route 5 6 7 8 calls 5 6 7 8 View user w 5 6 7 system-config-network 5 6 sessions Change gnome-control-center 8 nmcli process renice 5 6 7 8 Configure nmtui 7 8 priority routes nm-connection-editor Change ip route add 5 6 7 8 taskset /etc/sysconfig/route-iface process run 5 6 7 8 location iptables and ip6tables 5 6 /etc/sysconfig/ip*tables Kill a process pkill 5 6 7 8 Configure system-config-firewall 6 killall firewall firewall-cmd 7 8 netstat 5 6 firewall-config ss nftables 8 tuna 6 7 8

pcp-dstat--socket 8 pcp atop 8 View ports/ View system ss top sockets usage lsof 5 6 7 8 netstat sar iostat 5 6 7 8 vmstat mpstat numastat

iostat 6 7 8 View disk pcp-dstat usage pmiostat 8

df 5 6 7 8

5/19

Copyright © 2019 Red Hat, Inc. Red Hat, Red Hat Enterprise Linux, the Red Hat logo, and 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 U.S. and other countries.