RED HAT ENTERPRISE LINUX,, AND Common administrative commands SYSTEM BASICS View subscription information /etc/sysconfig/rhn/systemid /etc/sysconfig/rhn/systemid subscription-manager identity subscription-manager identity 1 Be aware of potential iues when using subscription-manager on Red Hat Enterprise Linux : htt://acce.redhat.com/ solutions/129003. 2 Subscription-manager is used for Satellite, Satellite. with SAM and newer, and Red Hat s CDN. 3 RHN tools are deprecated on Red Hat Enterprise Linux. rhn_register should be used for Satellite server. and newer only. For details, see: Satellite. unable to register client system due to rhn-setup package not included in Minimal installation (htt://acce.redhat.com/ solutions/333) rhn_register subscription-manager 1 rhn_register subscription rhnreg_ks subscription-manager subscription-manager 2 rhn_register 3 sosreport dmidecode hwbrowser View system profile sosreport dmidecode lso lscpu View version information /etc/redhat-release BASIC CONFIGURATION RESOURCE MANAGEMENT mtat Graphical configuration tools network system language time and date Synchronize time and date system-config-* gnome-control-center system-config-network nmcli system-config-language localectl system-config-date date timedatectl date ntpdate /etc/ntp.conf timedatectl View system usage View disk usage mtat tuna mtat tuna keyboard Text-based configuration tools printer /etc/chrony.conf ntpdate system-config-keyboard localectl system-config-*-tui system-config-printer Trace system calls Trace library calls Change proce priority Change proce run location strace ltrace nice renice taskset SSH /etc/h/h_config /etc/h/hd_config ~/.h/config h-keygen Kill a proce kill pkill killall
SOFTWARE MANAGEMENT NETWORKING Install software yum install yum groupinstall yum install yum group install firewall iptables and iptables /etc/sysconfig/ip*tables iptables and iptables /etc/sysconfig/ip*tables system-config-firewall View software info Update software Upgrade software software repository yum info yum groupinfo yum info yum group info yum update yum upgrade subscription-manager repos /etc/yum.repos.d/*.repo name resolution hostname firewall-cmd firewall-config /etc/hosts /etc/resolv.conf /etc/hosts /etc/resolv.conf nmcli con mod /etc/sysconfig/network hostnamectl /etc/hostname Find file in package View software version View installed software rpm -qf filename yum provides filename-glob rpm -q packagename rpm -qa yum list installed USER MANAGEMENT View network interface info network interface ip addr ifconfig brctl ip addr nmcli dev show teamdctl brctl bridge /etc/sysconfig/network-scripts/ifcfg-* /etc/sysconfig/network-scripts/ifcfg-* nmcli con [add mod edit] Graphical user management Create user account Delete user account View/change user account details Create user group system-config-users useradd userdel usermod /etc/pawd vipw id groupadd View ports/ sockets routes View routes lsof lsof ip route add system-config-network /etc/sysconfig/route-iface ip route add nmcli /etc/sysconfig/route-iface ip route Delete user group Change group details groupdel groupmod /etc/group SECURITY AND IDENTITY Change user paword Change user permiions pawd usermod visudo system security /etc/selinux/config chcon restorecon semanage setsebool system-config-selinux Change group permiions groupmod visudo Report on system security sealert Change paword policy View user seions chage w LDAP, SSSD, Kerberos Network users authconfig authconfig-tui authconfig-gtk getent
JOBS AND SERVICES /etc/syslog.conf /etc/rsyslog.conf logging /etc/rsyslog.conf /etc/rsyslog.d/*.conf /var/log/journal systemd-journald.service chkconfig --list ls /etc/init.d/ List all services systemctl -at service ls /etc/systemd/system/*.service ls /usr/lib/systemd/system/*.service List running services service --status-all systemctl -t service --state=active Start/s service service name start service name s systemctl start name.service systemctl s 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 View logs /var/log /var/log journalctl system audit View audit output Schedule/batch tasks Find file by name Find file by characteristic Create archive 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 aureport /var/log/faillog cron at batch locate find tar cpio zip
FILE SYSTEMS, VOLUMES, AND DISKS ext3 Default file system ext4 xfs copy data to new file system fsck (look for non-contiguous inodes ) Defragment disk space copy data to new file system fsck (look for non-contiguous inodes ) xfs_fsr fdisk parted Create/modify disk partitions fdisk gdisk parted m create mkfs.filesystem_type (ext4, xfs) mkswap Format disk partition mkfs.filesystem_type (ext4, xfs) mkswap m create Mount storage m Create physical volume pvcreate pvcreate m create (if backend is lvm) Create volume group vgcreate vgcreate m create (if backend is lvm) Create logical volume lvcreate lvcreate m create (if backend is lvm) Enlarge volumes formatted with default file system vgextend lvextend resize2fs vgextend lvextend xfs_growfs m 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 m check NFS share /etc/exports service nfs reload /etc/exports systemctl reload nfs.service Mount and activate swap static s View free disk space swapon -a
FILE SYSTEMS, VOLUMES, AND DISKS (CONT.) View logical volume info View NFS share on-demand auto-s Change file permiions Change file attributes Change acce control list lvdisplay lvs vgdisplay vgs pvdisplay pvs show -e /etc/auto.master.d/*.autofs /etc/auto.* chmod chown chgrp umask (future file creation) chattr setfacl KERNEL, BOOT, AND HARDWARE Single user/rescue mode append 1 or s or init=/bin/bash to kernel cmdline append rd.break or init=/bin/bash to kernel cmdline Shut down system shutdown shutdown systemctl shutdown Power off system poweroff poweroff systemctl poweroff Halt system halt halt systemctl halt Reboot system reboot reboot systemctl reboot default run level/target /etc/inittab systemctl set-default /boot/grub/grub.conf GRUB bootloader /etc/default/grub grub2-mkconfig grub-set-default View hardware configured hwbrowser lshw (in EPEL) kernel module hardware device View kernel parameters Load kernel module modprobe udev sysctl -a cat /proc/cmdline modprobe Remove kernel module modprobe -r View kernel version rpm -q kernel uname -r 11/14 Copyright 2014 Red Hat, Inc. Red Hat, Red Hat Enterprise Linux, the Shadowman logo, and JBo 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.