Sei sulla pagina 1di 5

RED HAT ENTERPRISE LINUX 5, 6, AND 7 Common administrative commands

SYSTEM BASICS

TASK

RHEL

 
 

/etc/sysconfig/rhn/systemid

5
5

/etc/sysconfig/rhn/systemid

 
6
6
 

View subscription information

subscription-manager identity

subscription-manager identity

 
7
7
 

rhn_register

5
5
 

subscription-manager 1

rhn_register

 

Configure subscription

rhnreg_ks

 
6
6

subscription-manager

 
 

subscription-manager 2

 
7
7

rhn_register 3

 

sosreport

 

dmidecode

5
5
 

hwbrowser

View system profile

sosreport

 

dmidecode

 
6
6
7
7

lstopo

lscpu

 

View RHEL version information

/etc/redhat-release

5
5
6
6
7
7

BASIC CONFIGURATION

TASK

RHEL

 

Graphical configuration tools

system-config-*

5
5
6
6

gnome-control-center

 
7
7
 

system-config-network

5
5
6
6

Configure network

nmcli

 

nmtui

 
7
7
 

nm-connection-editor

 

Configure system language

system-config-language

5
5
6
6

localectl

 
7
7
 

system-config-date

5
5
6
6
 

Configure time and date

date

timedatectl

 
7
7
 

date

 

ntpdate

5
5
6
6
 

/etc/ntp.conf

Synchronize time and date

timedatectl

 

/etc/chrony.conf

 
7
7

ntpdate

 

Configure keyboard

system-config-keyboard

5
5
6
6

localectl

 
7
7

Text-based configuration tools

system-config-*-tui

5
5
6
6
7
7

Configure printer

system-config-printer

5
5
6
6
7
7
 

/etc/ssh/ssh_config

 

Configure SSH

/etc/ssh/sshd_config

5
5
6
6
7
7

~/.ssh/config ssh-keygen

 

1 Be aware of potential issues when using subscription-manager on Red Hat Enterprise Linux 5: https://access.redhat.com/

solutions/129003.

2 Subscription-manager is used for Satellite 6, Satellite 5.6 with SAM and newer, and Red Hat’s CDN.

3 RHN tools are deprecated on Red Hat Enterprise Linux 7. rhn_register should be used for Satellite server 5.6 and newer

RESOURCE MANAGEMENT

 

TASK

RHEL

 
 

top

 

ps

sar

iostat

5
5
 

netstat

vmstat

 

mpstat

numastat

top

 

ps

sar

iostat

netstat

 
6
6
 

View system usage

ss

vmstat

 
 

mpstat

numastat

tuna

top

 

ps

sar

iostat

ss

 
7
7

vmstat

mpstat

 

numastat

tuna

 

df

5
5

View disk usage

df

 
6
6
7
7

iostat

Trace system calls

strace

5
5
6
6
7
7

Trace library calls

ltrace

5
5
6
6
7
7

Change process

nice

5
5
6
6
7
7

priority

renice

Change process

taskset

5
5
6
6
7
7

run location

 

kill

 

Kill a process

pkill

5
5
6
6
7
7

killall

 

SOFTWARE MANAGEMENT

 

TASK

RHEL

 
 

yum install

5
5
6
6
 

yum groupinstall

Install software

yum install

 
7
7

yum group install

 

yum info

5
5
6
6
 

View software

yum groupinfo

info

yum info

 
7
7

yum group info

Update software

yum update

5
5
6
6
7
7

Upgrade software

yum upgrade

5
5
6
6
7
7

Configure

   

software

repository

subscription-manager repos

/etc/yum.repos.d/*.repo

5
5
6
6
7
7

Find file in package

rpm -qf filename

5
5
6
6
7
7

yum provides filename-glob

View software

 
5
5
6
6
7
7

version

rpm -q packagename

View installed

rpm -qa

5
5
6
6
7
7

software

yum list installed

USER MANAGEMENT

 

TASK

RHEL

 

Graphical user

 
5
5
6
6
7
7

management

system-config-users

Create user

 
5
5
6
6
7
7

account

useradd

Delete user

 
5
5
6
6
7
7

account

userdel

 

usermod

 

View/change user

/etc/passwd

5
5
6
6
7
7

account details

vipw

id

 

Create user group

groupadd

5
5
6
6
7
7

Delete user group

groupdel

5
5
6
6
7
7

Change group

groupmod

5
5
6
6
7
7

details

/etc/group

Change user

 
5
5
6
6
7
7

password

passwd

Change user

usermod

5
5
6
6
7
7

permissions

visudo

Change group

groupmod

5
5
6
6
7
7

permissions

visudo

Change password

 
5
5
6
6
7
7

policy

chage

View user

 
5
5
6
6
7
7

sessions

w

NETWORKING

 

TASK

RHEL

 
 

iptables and ip6tables

5
5
 

/etc/sysconfig/ip*tables

Configure

firewall

iptables and ip6tables

 

/etc/sysconfig/ip*tables system-config-firewall

 
6
6
 

firewall-cmd

 
7
7

firewall-config

 

/etc/hosts

5
5
6
6
 

Configure

/etc/resolv.conf

name

/etc/hosts

 

resolution

/etc/resolv.conf nmcli con mod

 
7
7
 

/etc/sysconfig/network

5
5
6
6

Configure

hostnamectl

 

hostname

/etc/hostname

 
7
7

nmtui

 
 

ip addr

 

ifconfig

5
5
6
6

brctl

 

View network

   

interface info

ip addr

nmcli dev show teamdctl brctl

 
7
7

bridge

 
 

/etc/sysconfig/network-scripts/ifcfg-*

5
5
6
6

Configure

   

network

/etc/sysconfig/network-scripts/ifcfg-* nmcli con [add|mod|edit] nmtui nm-connection-editor

interface

 
7
7
 

ss

 

lsof

5
5
6
6

View ports/

sockets

netstat

 

ss

 
7
7
 

lsof

 

ip route add system-config-network

5
5
6
6

/etc/sysconfig/route-iface

 

Configure

ip route add nmcli nmtui

nm-connection-editor /etc/sysconfig/route-iface

 

routes

 
7
7

View routes

ip route

5
5
6
6
7
7

SECURITY AND IDENTITY

 

TASK

RHEL

 
 

/etc/selinux/config

 

chcon

Configure system

restorecon

5
5
6
6
7
7

security

semanage

setsebool

 

system-config-selinux

Report on system security

sealert

5
5
6
6
7
7
 

authconfig

 

LDAP, SSSD,

Kerberos

authconfig-tui

authconfig-gtk

5
5
6
6
7
7

Network users

getent

5
5
6
6
7
7

JOBS AND SERVICES

TASK

RHEL

 
 

/etc/syslog.conf

5
5

/etc/rsyslog.conf

 
6
6

Configure logging

/etc/rsyslog.conf

 

/etc/rsyslog.d/*.conf

 
7
7

/var/log/journal

systemd-journald.service

 
 

chkconfig --list

5
5
6
6
 

ls /etc/init.d/

List all services

systemctl -at service ls /etc/systemd/system/*.service ls /usr/lib/systemd/system/*.service

 
7
7
 

service --status-all

5
5
6
6

List running services

systemctl -t service --state=active

 
7
7
 

service name start service name stop

5
5
6
6

Start/stop service

systemctl start name.service systemctl stop name.service

 
7
7
 

chkconfig name on chkconfig name off

5
5
6
6

Enable/disable service

systemctl enable name.service systemctl disable name.service

 
7
7
 

service name status

5
5
6
6

View service status

systemctl status name.service

 
7
7
 

chkconfig name --list

5
5
6
6

Check if service is enabled

systemctl is-enabled name

 
7
7
 

chkconfig --add

5
5
6
6

Create new service file or modify configuration

systemctl daemon-reload /etc/systemd/system/*.service

 
7
7
 

runlevel

5
5
6
6
 

View run level/target

who -r

systemctl get-default who -r

 
7
7
 

/etc/inittab

5
5
6
6
 

Change run level/target

init run_level

systemctl isolate name.target systemctl set-default

 
7
7
 

/var/log

5
5
6
6

View logs

/var/log

 
7
7

journalctl

Configure system audit

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

5
5
6
6
7
7

View audit output

aureport /var/log/faillog

5
5
6
6
7
7
 

cron

 

Schedule/batch tasks

at

5
5
6
6
7
7

batch

 

Find file by name

locate

5
5
6
6
7
7

Find file by characteristic

find

5
5
6
6
7
7
 

tar

 

Create archive

cpio

5
5
6
6
7
7

zip

 

FILE SYSTEMS, VOLUMES, AND DISKS

 

TASK

RHEL

 
 

ext3

5
5

Default file system

ext4

 
6
6

xfs

 
7
7
 

copy data to new file system fsck (look for ‘non-contiguous inodes’)

5
5

Defragment disk space

copy data to new file system fsck (look for ‘non-contiguous inodes’) xfs_fsr

 
6
6
7
7
 

fdisk

5
5
6
6
 

parted

Create/modify disk partitions

fdisk

 

gdisk

 
7
7
 

parted

ssm create

 
 

mkfs.filesystem_type (ext4, xfs) mkswap

5
5
6
6

Format disk partition

mkfs.filesystem_type (ext4, xfs) mkswap ssm create

 
7
7
 

mount

5
5
6
6
 

/etc/fstab

Mount storage

mount

 

/etc/fstab

 
7
7

ssm mount

 

pvcreate

5
5
6
6

Create physical volume

pvcreate ssm create (if backend is lvm)

 
7
7
 

vgcreate

5
5
6
6

Create volume group

vgcreate ssm create (if backend is lvm)

 
7
7
 

lvcreate

5
5
6
6

Create logical volume

lvcreate ssm create (if backend is lvm)

 
7
7
 

vgextend

 

lvextend

5
5
6
6

Enlarge volumes formatted with default file system

resize2fs

 

vgextend

 

lvextend

 
7
7
 

xfs_growfs

ssm resize

 
 

resize2fs

 

lvreduce

5
5
6
6

Shrink volumes formatted with default file system

vgreduce

 

XFS cannot currently be shrunk; copy desired data to a smaller file system.

 
7
7
 

fsck

5
5
6
6

Check/repair file system

fsck

 
7
7

ssm check

 

/etc/exports service nfs reload

5
5
6
6

Configure NFS share

/etc/exports systemctl reload nfs.service

 
7
7
 

/etc/fstab

5
5
6
6
7
7

Mount and activate swap

swapon -a

Configure static mounts

/etc/fstab

5
5
6
6
7
7

View free disk space

df

5
5
6
6
7
7

FILE SYSTEMS, VOLUMES, AND DISKS (CONT.)

 

TASK

RHEL

 
 

lvdisplay

 

lvs

vgdisplay

5
5
6
6
7
7

View logical volume info

vgs

pvdisplay

 

pvs

 

showmount -e

5
5
6
6
7
7

View NFS share

mount

 

/etc/auto.master.d/*.autofs

5
5
6
6
7
7

Configure on-demand auto-mounts

/etc/auto.*

Change file permissions

chmod chown chgrp umask (future file creation)

5
5
6
6
7
7

Change file attributes

chattr

5
5
6
6
7
7

Change access control list

setfacl

5
5
6
6
7
7

KERNEL, BOOT, AND HARDWARE

 

TASK

RHEL

 

Single user/rescue mode

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

5
5
6
6

append rd.break or init=/bin/bash to kernel cmdline

 
7
7
 

shutdown

5
5
6
6

Shut down system

shutdown

 

systemctl shutdown

 
7
7
 

poweroff

5
5
6
6

Power off system

poweroff

 
7
7

systemctl poweroff

 

halt

5
5
6
6

Halt system

halt

 
7
7

systemctl halt

 

reboot

5
5
6
6

Reboot system

reboot

 
7
7

systemctl reboot

Configure default run level/target

/etc/inittab

5
5
6
6

systemctl set-default

 
7
7
 

/boot/grub/grub.conf

5
5
6
6

Configure GRUB bootloader

/etc/default/grub

 

grub2-mkconfig

 
7
7
 

grub-set-default

 

View hardware configured

hwbrowser

5
5

lshw (in EPEL)

 
6
6
7
7

Configure kernel module

modprobe

5
5
6
6
7
7

Configure hardware device

udev

5
5
6
6
7
7
 

sysctl -a

5
5
6
6
7
7

View kernel parameters

cat /proc/cmdline

Load kernel module

modprobe

5
5
6
6
7
7

Remove kernel module

modprobe -r

5
5
6
6
7
7

View kernel version

rpm -q kernel uname -r

5
5
6
6
7
7

11/14

Copyright © 2014 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.

the U.S. and other countries. Linux ® is the registered trademark of Linus Torvalds in the