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

System basics Basic configuration TASK RHEL TASK RHEL

View /etc/sysconfig/rhn/systemid 5 6 Graphical system-config-* 5 6 subscription configuration information subscription-manager identity 6 7 8 tools gnome-control-center 7 8

rhnreg_ks 6 Text-based Configure configuration system-config-*-tui 5 6 rhn_register 1, 3 5 6 7 8 subscription tools

subscription-manager 2 6 7 8 Configure system-config-printer 5 6 7 hwbrowser 5 printer gnome-control-center 8 sosreport system-config-network 5 6 dmidecode 5 6 7 8 View system nmcli profile lstopo Configure 6 7 8 nmtui 7 8 lscpu network nm-connection-editor cat/proc/cpuinfo 8 gnome-control-center 8 lshw system-config-language 5 6 View RHEL Configure system localectl 7 8 version /etc/redhat-release 5 6 7 8 language information gnome-control-center 8

system-config-date 5 6 1 Be aware of potential issues when using subscription-manager on 5: https://access.redhat.com/solutions/129003. Configure timedatectl 7 8 2 Subscription-manager is used for 6, Satellite 5.6 with SAM and newer, time and date date 5 6 7 8 and Red Hat’s CDN. 3 RHN tools are deprecated on Red Hat Enterprise Linux 7. rhn_register should gnome-control-center 8 be used for Satellite server 5.6 and newer only. For details, see: What subscription /etc/ntp.conf 5 6 management services are offered by RHSM?, Transition of Red Hat Network Classic Hosted to Red Hat Subscription Management, and Satellite 5.6 unable ntpdate 5 6 7 to register RHEL 7 client system due to rhn-setup package not included in Minimal installation. Synchronize timedatectl time and date /etc/chrony.conf 7 8

date 8 chronyc

Security and identity system-config-keyboard 5 6 Configure localectl TASK RHEL keyboard 7 8 /etc/selinux/config gnome-control-center 8 chcon Configure /etc/ssh/ssh_config restorecon system Configure /etc/ssh/sshd_config semanage 5 6 7 8 5 6 7 8 SSH ~/.ssh/config security setsebool ssh-keygen system-config-selinux

Report on system sealert 5 6 7 8 security

authconfig LDAP, SSSD, authconfig-tui 5 6 7 authconfig-gtk Kerberos authselect 8

Network users getent 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 batch systemctl -at service batch tasks ls /etc/systemd/system/*.service systemd-run --on-calendar 8 List all ls /usr/lib/systemd/system/*. 7 services service Find file by locate 5 6 7 8 systemctl list-units -at service name find /etc/systemd/ /usr/lib/ 8 systemd/ /run/systemd/ -name Find file by find *.service” characteristic 5 6 7 8 service --status-all 5 6 List running tar systemctl -t service cpio services 7 8 Create archive 5 6 7 8 --state=active zip xz service name start 5 6 Start/stop service name stop service systemctl start name.service 7 8 systemctl stop name.service User management chkconfig name on 5 6 TASK RHEL Enable/ chkconfig name off disable systemctl enable name.service Graphical user system-config-users 5 6 7 service 7 8 systemctl disable name.service management gnome-control-center 8 View service service name status 5 6 useradd 5 6 7 status systemctl status name.service Create user 7 8 account gnome-control-center 8 Check if chkconfig name --list 5 6 service is Delete user userdel 5 6 7 enabled systemctl is-enabled name 7 8 account gnome-control-center 8 chkconfig --add Create new 5 6 usermod service file View/change /etc/passwd or modify systemctl daemon-reload 5 6 7 7 8 user account vipw configuration /etc/systemd/system/*.service details id

runlevel 5 6 gnome-control-center 8 View run systemctl get-default 7 8 level/target Create user groupadd 5 6 7 who -r 5 6 7 8 group gnome-control-center 8 /etc/inittab 5 6 Change run init run_level Delete user groupdel 5 6 7 level/target systemctl isolate name.target group 7 8 gnome-control-center 8 systemctl set-default groupmod /etc/syslog.conf 5 5 6 7 Change group /etc/group /etc/rsyslog.conf 6 7 8 details Configure gnome-control-center 8 logging /etc/rsyslog.d/*.conf /var/log/journal 7 8 Change user passwd 5 6 7 systemd-journald.service password gnome-control-center 8 journalctl 7 8 View logs usermod /var/log 5 6 7 8 5 6 7 Change user visudo pam_tty_audit kernel module 5 6 7 permissions gnome-control-center 8 tlog 8 chage 5 6 7 Configure add audit=1 to kernel cmdline Change system audit auditctl password /etc/audit/auditd.conf policy gnome-control-center 8 5 6 7 8 /etc/audit/audit.rules authconfig w 5 6 7 /etc/pam.d/system-auth View user sessions gnome-control-center 8 View audit aureport output /var/log/faillog 5 6 7 Software management Kernel, boot, and hardware

TASK RHEL TASK RHEL

groupinstall 5 6 append 1 or s or init=/bin/bash to kernel cmdline 5 6 Install Single user/ yum group install software 7 8 rescue mode append 1 or s or rd.break or init=/bin/bash to kernel 7 8 yum install 5 6 7 8 cmdline

yum groupinfo 5 6 Shut down shutdown 5 6 7 8 View software system yum group info info 7 8 systemctl poweroff 7 8 yum info 5 6 7 8 Power off system poweroff 5 6 7 8 Update yum update 5 6 7 8 software systemctl halt 7 8 Halt system halt 5 6 7 8 Upgrade yum upgrade software 5 6 7 8 Reboot systemctl reboot 7 8 system reboot 5 6 7 8 Configure subscription-manager repos software 5 6 7 8 /etc/yum.repos.d/*.repo /etc/inittab repository Configure 5 6 default run level/target systemctl set-default 7 8 Find package rpm -qf filename 5 6 7 8 owning file yum provides filename-glob /boot/grub/grub.conf Configure 5 6 rpm -q packagename 5 6 GRUB /etc/default/grub View software bootloader grub2-mkconfig 7 8 version yum list installed packagename grub-set-default 7 8 rpm -q packagename hwbrowser 5 View hardware View installed rpm -qa lshw (in EPEL) 6 7 5 6 7 8 configured software yum list installed lshw 8 Install a yum module install module_name 8 module Configure modprobe kernel module 5 6 7 8

View info on a yum module info module_name module 8 Configure hardware udev 5 6 7 8 device View a module’s yum module info module_name 8 streams View kernel sysctl -a parameters cat /proc/cmdline 5 6 7 8 yum module remove Load kernel Change module_name:stream modprobe 5 6 7 8 module yum module reset module:stream 8 module streams yum module install module:new_stream Remove modprobe -r kernel module 5 6 7 8 List available yum module list 8 modules View kernel rpm -q kernel version uname -r 5 6 7 8 File systems, volumes, and disks File systems, volumes, and disks (cont.)

TASK RHEL TASK RHEL

ext3 5 View NFS showmount -e Default file share mount 5 6 7 8 system ext4 6 xfs 7 8 service nfs reload 5 6 Configure ssm create 7 systemctl reload nfs.service NFS share 7 8 Create/ gdisk 7 8 /etc/exports 5 6 7 8 modify disk ssm_create 8 partitions Configure fdisk /etc/auto.master.d/*.autofs 5 6 7 8 on-demand 8 parted /etc/auto.* auto-mounts ssm create 7 8 Format disk chmod mkfs.filesystem_type (ext4, xfs) Change file partition 5 6 7 8 chown mkswap permissions chgrp 8 umask (future file creation) xfs_fsr 6 7 8 Defragment Change file copy data to new file system chattr 8 disk space fsck (look for ‘non-contiguous 5 6 7 8 attributes inodes’) Change ssm mount 7 8 Mount access setfacl 8 storage mount control list 5 6 7 8 /etc/fstab

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

Configure /etc/fstab static mounts 5 6 7 8 TASK RHEL Trace system View free disk strace 5 6 7 8 df calls space 5 6 7 8 Trace library lvdisplay ltrace 5 6 7 8 lvs calls View logical vgdisplay 5 6 7 8 volume info vgs Change nice pvdisplay process pvs renice 5 6 7 8 priority Create ssm create (if backend is lvm) 8 physical Change volume pvcreate 5 6 7 8 process run taskset 5 6 7 8 location ssm create (if backend is lvm) 8 Create volume kill group vgcreate 5 6 7 8 Kill a process pkill 5 6 7 8 killall ssm create (if backend is lvm) 8 Create logical netstat 5 6 volume lvcreate 5 6 7 8 ss tuna 6 7 8 resize2fs Enlarge 5 6 volumes pcp atop 8 xfs_growfs View system formatted 7 8 ssm resize usage top with default ps vgextend file system 5 6 7 8 sar lvextend iostat 5 6 7 8 vmstat resize2fs mpstat Shrink lvreduce 5 6 numastat volumes vgreduce formatted iostat 6 7 8 with default XFS cannot currently be shrunk; file system copy desired data to a smaller 7 8 View disk pcp-dstat file system. usage pmiostat 8

Check/repair ssm check 8 df 5 6 7 8 file system fsck 5 6 7 8 Networking

TASK RHEL

Configure nmcli con mod 7 8 name /etc/hosts 5 6 7 8 resolution /etc/resolv.conf

/etc/sysconfig/network 5 6 Configure hostnamectl hostname /etc/hostname 7 8 nmtui

ifconfig 5 6

nmcli dev show View network teamdctl 7 8 interface info bridge

ip addr 5 6 7 8 brctl

nmcli con [add|mod|edit] Configure nmtui 7 8 network nm-connection-editor interface /etc/sysconfig/network-scripts/ 5 6 7 8 ifcfg-*

View routes ip route 5 6 7 8

system-config-network 5 6

nmcli Configure nmtui 7 8 routes nm-connection-editor

ip route add 5 6 7 8 /etc/sysconfig/route-iface

iptables and ip6tables 5 6 /etc/sysconfig/ip*tables

Configure system-config-firewall 6 firewall firewall-cmd 7 8 firewall-config

nftables 8

pcp-dstat--socket 8 View ports/ ss sockets lsof 5 6 7 8 netstat

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.