Anda di halaman 1dari 1

RED HAT ENTERPRISE LINUX 5, 6, AND 7

Common administrative commands

KERNEL, BOOT, AND HARDWARE


TASK

Single user/rescue mode

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

6
7

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

SYSTEM BASICS

JOBS AND SERVICES

TASK

RHEL
/etc/sysconfig/rhn/systemid

View subscription
information

/etc/sysconfig/rhn/systemid
subscription-manager identity

rhn_register
subscription-manager 1

View system profile

View RHEL version


information

List all services


7

List running services

Reboot system
7

Start/stop service

service name start


service name stop

6
7

Enable/disable service

View hardware configured


5

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

View service status

2 Subscription-manager is used for Satellite 6, Satellite 5.6 with SAM and newer, and Red Hats CDN.
3 RHN tools are deprecated on Red Hat Enterprise Linux 7. rhn_register should be used for Satellite server 5.6 and
newer only. For details, see: Satellite 5.6 unable to register RHEL 7 client system due to rhn-setup package not
included in Minimal installation (https://access.redhat.com/solutions/737373)

service name status

7
5

Check if service is enabled

chkconfig name --list

6
7

systemctl is-enabled name

Create new service file or


modify configuration

BASIC CONFIGURATION
TASK

Graphical configuration
tools

RHEL
system-config-*

Configure system
language

Configure time and date

6
7

system-config-date
date

Synchronize time
and date

Configure keyboard

ntpdate
/etc/ntp.conf

system-config-keyboard

6
7

localectl

Text-based
configuration tools

system-config-*-tui

Configure printer

system-config-printer

Configure SSH

/etc/ssh/ssh_config
/etc/ssh/sshd_config
~/.ssh/config ssh-keygen

View logs

/etc/inittab
init run_level

TASK
top
ps
sar
iostat
netstat
vmstat
mpstat
numastat

cron
at
batch

Find file by name

locate

View system usage

Configure name resolution

Configure hostname

df

View disk usage

View network interface info

Trace system calls

strace

Trace library calls

ltrace

Change process priority

nice
renice

Change process run


location

taskset

Kill a process

kill
pkill
killall

Configure network interface

View ports/sockets

Configure routes

View routes

RHEL

ss
lsof
netstat

ip route add
system-config-network
/etc/sysconfig/route-iface

USER MANAGEMENT
TASK

ip route

system-config-users

SOFTWARE MANAGEMENT

Create user account

useradd

TASK

Delete user account

userdel

View/change user
account details

usermod
/etc/passwd
vipw
id

Create user group

groupadd

Install software

yum info
yum groupinfo

Change group details

groupmod
/etc/group

Change user password

passwd

Load kernel module

modprobe

Remove kernel module

modprobe -r

View kernel version

rpm -q kernel
uname -r

RHEL

View software info

Create/modify disk
partitions

Upgrade software

yum update
yum upgrade

Format disk partition

mount
/etc/fstab

Mount storage

Enlarge volumes formatted


with default file system

6
7

Shrink volumes formatted


with default file system

Check/repair file system

Configure NFS share


5

6
6

resize2fs
lvreduce
vgreduce

/etc/exports
service nfs reload

7
5

6
7

6
7

View free disk space

df

View logical volume info

lvdisplay
lvs
vgdisplay
vgs
pvdisplay
pvs

View NFS share

showmount -e
mount

Configure on-demand
auto-mounts

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

Change file permissions

chmod
chown
chgrp
umask (future file creation)

Change file attributes

chattr

Change access control list

setfacl

TASK

RHEL

Configure system security

/etc/selinux/config
chcon
restorecon
semanage
setsebool
system-config-selinux

Report on system security

sealert

LDAP, SSSD, Kerberos

authconfig
authconfig-tui
authconfig-gtk

Network users

getent

7
7

10/14

View installed software

rpm -qa
yum list installed

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.

/etc/fstab

rpm -q packagename

View user sessions

Configure static mounts

View software version

fsck
ssm check

chage

XFS cannot currently be shrunk; copy desired data


to a smaller file system.

rpm -qf filename


yum provides filename-glob

Change password policy

vgextend
lvextend
xfs_growfs
ssm resize

Find file in package

lvcreate
ssm create (if backend is lvm)

vgcreate
ssm create (if backend is lvm)

6
7

SECURITY AND IDENTITY


7

/etc/fstab
swapon -a

pvcreate
ssm create (if backend is lvm)

vgextend
lvextend
resize2fs

Mount and activate swap

/etc/exports
systemctl reload nfs.service

mount
/etc/fstab
ssm mount

fsck

mkfs.filesystem_type (ext4, xfs)


mkswap
ssm create

groupmod
visudo

fdisk
gdisk
parted
ssm create

Change group
permissions

copy data to new file system


fsck (look for non-contiguous inodes)
xfs_fsr

mkfs.filesystem_type (ext4, xfs)


mkswap

yum info
yum group info

Update software

ext4

subscription-manager repos
/etc/yum.repos.d/*.repo

Change user permissions

Configure software
repository

usermod
visudo

yum install
yum groupinstall
yum install
yum group install

groupdel

Create logical volume

RHEL

Delete user group

sysctl -a
cat /proc/cmdline

Create volume group

ip route add
nmcli
nmtui
nm-connection-editor
/etc/sysconfig/route-iface

Graphical user
management

ss
lsof

View kernel parameters

ip addr
nmcli dev show
teamdctl
brctl
bridge

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

vgcreate

hostnamectl
/etc/hostname
nmtui

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

df
iostat

lvcreate

/etc/hosts
/etc/resolv.conf
nmcli con mod

iptables and ip6tables


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

ip addr
ifconfig
brctl

top
ps
sar
iostat
ss
vmstat
mpstat
numastat
tuna

udev

RHEL

/etc/sysconfig/network

Configure hardware device

Create physical volume

/etc/hosts
/etc/resolv.conf

fdisk
parted

firewall-cmd
firewall-config

top
ps
sar
iostat
netstat
ss
vmstat
mpstat
numastat
tuna

hwbrowser

pvcreate

Configure firewall

Schedule/batch tasks

RHEL

Defragment disk space

iptables and ip6tables


/etc/sysconfig/ip*tables

/etc/default/grub
grub2-mkconfig
grub-set-default

copy data to new file system


fsck (look for non-contiguous inodes)

TASK

NETWORKING
RESOURCE MANAGEMENT

xfs

Create archive

modprobe

Default file system

aureport /var/log/faillog

tar
cpio
zip

systemctl set-default

ext3

View audit output

find

/etc/inittab

TASK

/var/log
journalctl

Find file by characteristic

Configure system audit

FILE SYSTEMS, VOLUMES, AND DISKS

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

timedatectl
/etc/chrony.conf
ntpdate

runlevel
who -r

systemctl isolate name.target


systemctl set-default

timedatectl
date

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

/var/log
7

Change run level/target

localectl

systemctl get-default
who -r

nmcli
nmtui
nm-connection-editor
system-config-language

View run level/target

gnome-control-center
system-config-network

Configure network

chkconfig --add

Configure kernel module

systemctl status name.service

6
7

lshw (in EPEL)

systemctl enable name.service


systemctl disable name.service

reboot
systemctl reboot

/boot/grub/grub.conf

Configure GRUB bootloader

systemctl start name.service


systemctl stop name.service
chkconfig name on
chkconfig name off

Configure default run


level/target

halt
systemctl halt
reboot

systemctl -at service


ls /etc/systemd/system/*.service
ls /usr/lib/systemd/system/*.service
service --status-all

Halt system

poweroff
systemctl poweroff
halt

systemctl -t service --state=active

/etc/rsyslog.conf
/etc/rsyslog.d/*.conf
/var/log/journal
systemd-journald.service
chkconfig --list
ls /etc/init.d/

sosreport
dmidecode
lstopo
lscpu
/etc/redhat-release

Configure logging

Power off system


6

shutdown
systemctl shutdown
poweroff

/etc/rsyslog.conf
7

subscription-manager 2
rhn_register 3

Shut down system


RHEL

/etc/syslog.conf
6

rhn_register
rhnreg_ks
subscription-manager

sosreport
dmidecode
hwbrowser

TASK

subscription-manager identity

Configure subscription

shutdown

Anda mungkin juga menyukai