Sei sulla pagina 1di 5

Common administrative commands

in Red Hat Enterprise Linux 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
1, 3 5 6 7 8
subscription
rhn_register tools
subscription-manager 2 6 7 8
Configure system-config-printer 5 6 7
hwbrowser 5 printer gnome-control-center 8
sosreport
5 6 7 8 system-config-network 5 6
dmidecode
View system nmcli
profile lstopo Configure
6 7 8 nmtui 7 8
lscpu network nm-connection-editor
cat/proc/cpuinfo 8
8 gnome-control-center
lshw
system-config-language 5 6
View RHEL Configure
version /etc/redhat-release 5 6 7 8
system localectl 7 8
information language
gnome-control-center 8

system-config-date 5 6
1 Be aware of potential issues when using subscription-manager on Red Hat
Enterprise Linux 5: https://access.redhat.com/solutions/129003. Configure timedatectl 7 8
2 Subscription-manager is used for Satellite 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
management services are offered by RHSM?, Transition of Red Hat Network
/etc/ntp.conf 5 6
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
TASK RHEL localectl 7 8
keyboard
/etc/selinux/config gnome-control-center 8
Configure chcon
/etc/ssh/ssh_config
restorecon Configure
system 5 6 7 8 /etc/ssh/sshd_config
semanage 5 6 7 8
security SSH ~/.ssh/config
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
systemctl -at service batch tasks batch

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 5 6 7 8
*.service” characteristic
service --status-all 5 6
List running tar
services systemctl -t service
7 8 Create archive cpio
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
Enable/ 5 6 TASK RHEL
chkconfig name off
disable
service systemctl enable name.service Graphical user system-config-users 5 6 7
7 8
systemctl disable name.service management
gnome-control-center 8
View service service name status 5 6
Create user useradd 5 6 7
status systemctl status name.service 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

Create new chkconfig --add 5 6 usermod


service file /etc/passwd
View/change 5 6 7
or modify systemctl daemon-reload
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 groupdel 5 6 7
Change run init run_level Delete user
level/target systemctl isolate name.target group
7 8 gnome-control-center 8
systemctl set-default
groupmod
/etc/syslog.conf 5 Change group 5 6 7
/etc/group
/etc/rsyslog.conf 6 7 8 details
Configure gnome-control-center 8
logging /etc/rsyslog.d/*.conf
/var/log/journal 7 8 passwd 5 6 7
Change user
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
Change chage 5 6 7
Configure add audit=1 to kernel cmdline
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
5 6 7
output /var/log/faillog
Software management Kernel, boot, and hardware
TASK RHEL TASK RHEL

yum groupinstall 5 6 append 1 or s or init=/bin/bash


to kernel cmdline 5 6
Install Single user/
yum group install 7 8 rescue mode
software 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 7 8
info
Power off systemctl poweroff 7 8
yum info 5 6 7 8
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 5 6 7 8
software systemctl reboot 7 8
Reboot
system
Configure reboot 5 6 7 8
subscription-manager repos
software 5 6 7 8
repository
/etc/yum.repos.d/*.repo Configure /etc/inittab 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 5 6
Configure
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 installed rpm -qa View hardware


lshw (in EPEL) 6 7
software yum list installed
5 6 7 8 configured
lshw 8
Install a yum module install module_name 8 Configure
module modprobe 5 6 7 8
kernel module
View info on a yum module info module_name 8 Configure
module
hardware udev 5 6 7 8
device
View a
module’s yum module info module_name 8
streams View kernel sysctl -a
5 6 7 8
parameters cat /proc/cmdline

yum module remove


Change module_name:stream Load kernel modprobe 5 6 7 8
module yum module reset module:stream 8 module
streams yum module install
module:new_stream Remove modprobe -r 5 6 7 8
kernel module
List available yum module list 8
modules View kernel rpm -q kernel
5 6 7 8
version uname -r
File systems, volumes, and disks File systems, volumes, and disks (cont.)
TASK RHEL TASK RHEL

ext3 5 View NFS showmount -e


Default file 5 6 7 8
ext4 6 share mount
system
xfs 7 8 service nfs reload 5 6
ssm create 7 Configure
NFS share
systemctl reload nfs.service 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 /etc/auto.* 8
parted
auto-mounts
ssm create 7 8
Format disk chmod
partition mkfs.filesystem_type (ext4, xfs)
5 6 7 8
Change file chown
mkswap permissions chgrp 8
umask (future file creation)
xfs_fsr 6 7 8
Defragment copy data to new file system Change file
disk space chattr 8
fsck (look for ‘non-contiguous 5 6 7 8 attributes
inodes’)

ssm mount 7 8
Change
Mount access setfacl 8
storage mount control list
5 6 7 8
/etc/fstab

Mount and /etc/fstab


5 6 7 8
activate swap swapon -a
Resource management
Configure /etc/fstab 5 6 7 8 TASK RHEL
static mounts
Trace system
View free disk calls
strace 5 6 7 8
df 5 6 7 8
space

lvdisplay Trace library ltrace 5 6 7 8


lvs calls
View logical vgdisplay
volume info vgs 5 6 7 8
Change
pvdisplay nice
pvs
process 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
Create volume ssm create (if backend is lvm) 8
kill
group Kill a process pkill 5 6 7 8
vgcreate 5 6 7 8
killall
Create logical ssm create (if backend is lvm) 8
netstat 5 6
volume lvcreate 5 6 7 8 ss
tuna 6 7 8
Enlarge
resize2fs 5 6
volumes pcp atop 8
xfs_growfs
7 8 View system
formatted ssm resize
usage top
with default ps
file system vgextend
5 6 7 8 sar
lvextend iostat 5 6 7 8
vmstat
resize2fs
Shrink lvreduce 5 6
mpstat
volumes vgreduce
numastat
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
resolution /etc/resolv.conf
5 6 7 8

/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.

Potrebbero piacerti anche