Common administrative commands in Red Hat Enterprise Linux ...

Common administrative commands

in Red Hat Enterprise Linux 5, 6, 7, and 8

System basics

Basic configuration

TASK

View

subscription

information

Configure

subscription

RHEL

/etc/sysconfig/rhn/systemid

6

subscription-manager identity

6

rhnreg_ks

6

rhn_register

5

1, 3

subscription-manager

hwbrowser

View system

profile

5

sosreport

dmidecode

2

TASK

7

6

7

8

6

7

8

5

5

lstopo

lscpu

6

7

6

7

cat/proc/cpuinfo

lshw

View RHEL

version

information

/etc/redhat-release

8

Graphical

configuration

tools

Text-based

configuration

tools

Configure

printer

6

7

system-config-*

6

system-config-printer

5

6

system-config-language

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: What subscription

management services are offered by RHSM?, Transition of Red Hat Network

Classic Hosted to Red Hat Subscription Management, and Satellite 5.6 unable

to register RHEL 7 client system due to rhn-setup package not included in

Minimal installation.

5

6

7

Configure

time and date

5

6

7

5

6

timedatectl

5

6

7

8

7

8

8

gnome-control-center

Synchronize

time and date

/etc/ntp.conf

5

6

ntpdate

5

6

timedatectl

/etc/chrony.conf

7

7

date

chronyc

Security and identity

TASK

Configure

keyboard

RHEL

/etc/selinux/config

chcon

restorecon

semanage

setsebool

system-config-selinux

5

6

7

8

Report on

system

security

sealert

5

6

7

8

authconfig

authconfig-tui

authconfig-gtk

5

6

7

8

authselect

Network users

getent

5

6

7

localectl

5

6

7

8

Configure

SSH

/etc/ssh/ssh_config

/etc/ssh/sshd_config

~/.ssh/config

ssh-keygen

8

8

8

8

gnome-control-center

Configure

system

security

LDAP, SSSD,

Kerberos

system-config-keyboard

8

8

gnome-control-center

date

8

8

localectl

system-config-date

2 Subscription-manager is used for Satellite 6, Satellite 5.6 with SAM and newer,

and Red Hat¡¯s CDN.

8

gnome-control-center

Configure

system

language

8

7

gnome-control-center

8

1 Be aware of potential issues when using subscription-manager on Red Hat

Enterprise Linux 5: .

7

5

nmcli

nmtui

nm-connection-editor

8

6

system-config-*-tui

8

Configure

network

5

gnome-control-center

system-config-network

8

5

RHEL

5

6

7

8

Jobs and services (cont.)

Jobs and services

TASK

RHEL

chkconfig --list

ls /etc/init.d/

List all

services

5

TASK

6

systemctl -at service

ls /etc/systemd/system/*.service

ls /usr/lib/systemd/system/*.

service

Schedule/

batch tasks

List running

services

Start/stop

service

Enable/

disable

service

service --status-all

service name start

service name stop

chkconfig name on

chkconfig name off

chkconfig name --list

Create new

service file

or modify

configuration

chkconfig --add

View logs

View audit

output

who -r

5

6

/etc/inittab

init run_level

5

6

systemctl isolate name.target

systemctl set-default

8

tar

cpio

zip

xz

5

6

7

8

TASK

8

8

8

Graphical user

management

system-config-users

Create user

account

useradd

Delete user

account

userdel

8

7

8

7

8

8

5

8

/etc/rsyslog.d/*.conf

/var/log/journal

systemd-journald.service

7

8

journalctl

7

8

8

/var/log

5

6

7

pam_tty_audit kernel module

5

6

7

View/change

user account

details

5

6

6

6

7

8

gnome-control-center

5

6

7

8

gnome-control-center

5

6

7

8

gnome-control-center

/etc/passwd

vipw

5

6

7

id

Create user

group

groupadd

Delete user

group

groupdel

Change group

details

8

7

7

8

5

6

7

8

gnome-control-center

5

6

7

8

gnome-control-center

groupmod

/etc/group

5

6

7

8

gnome-control-center

Change user

password

Change user

permissions

passwd

5

6

7

8

gnome-control-center

usermod

visudo

5

6

7

8

gnome-control-center

8

5

5

gnome-control-center

7

6

RHEL

usermod

7

aureport

/var/log/faillog

7

6

systemctl get-default

add audit=1 to kernel cmdline

auditctl

/etc/audit/auditd.conf

/etc/audit/audit.rules

authconfig

/etc/pam.d/system-auth

6

User management

tlog

Configure

system audit

5

8

7

/etc/rsyslog.conf

find

6

systemctl daemon-reload

/etc/systemd/system/*.service

/etc/syslog.conf

Find file by

characteristic

7

7

5

8

6

systemctl is-enabled name

runlevel

7

Create archive

7

5

8

6

6

systemctl status name.service

5

8

5

8

7

5

7

locate

7

6

systemctl enable name.service

systemctl disable name.service

Check if

service is

enabled

Configure

logging

5

6

6

systemctl start name.service

systemctl stop name.service

service name status

Change run

level/target

5

5

Find file by

name

6

systemctl -t service

--state=active

View service

status

View run

level/target

8

5

cron

at

batch

systemd-run --on-calendar

7

systemctl list-units -at service

find /etc/systemd/ /usr/lib/

systemd/ /run/systemd/ -name

*.service¡±

RHEL

Change

password

policy

chage

View user

sessions

w

5

6

7

8

gnome-control-center

gnome-control-center

5

6

7

8

Software management

TASK

RHEL

yum groupinstall

Install

software

View software

info

5

6

yum groupinfo

5

6

yum group info

yum update

Upgrade

software

yum upgrade

View software

version

5

5

6

6

7

8

7

8

7

8

7

8

7

Single user/

rescue mode

Shut down

system

Power off

system

8

Halt system

RHEL

append 1 or s or init=/bin/bash

to kernel cmdline

subscription-manager repos

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

rpm -qf filename

yum provides filename-glob

rpm -q packagename

6

yum list installed

8

5

6

7

8

5

6

7

8

5

6

yum list installed packagename

rpm -qa

7

7

shutdown

6

7

5

6

poweroff

5

6

systemctl halt

5

6

Reboot

system

systemctl reboot

reboot

5

6

Configure

default run

level/target

/etc/inittab

5

6

Configure

GRUB

bootloader

/boot/grub/grub.conf

8

8

6

systemctl poweroff

systemctl set-default

View hardware

configured

5

7

8

7

8

7

8

7

8

7

8

7

8

7

8

7

8

7

8

7

8

6

/etc/default/grub

grub2-mkconfig

grub-set-default

hwbrowser

5

5

append 1 or s or rd.break or

init=/bin/bash to kernel

cmdline

halt

5

rpm -q packagename

View installed

software

TASK

6

yum install

Update

software

Find package

owning file

5

yum group install

yum info

Configure

software

repository

Kernel, boot, and hardware

5

6

lshw (in EPEL)

7

8

lshw

Install a

module

yum module install module_name

8

Configure

kernel module

modprobe

5

6

7

8

View info on a

module

yum module info module_name

8

udev

5

6

7

8

View a

module¡¯s

streams

Configure

hardware

device

yum module info module_name

View kernel

parameters

sysctl -a

cat /proc/cmdline

5

6

7

8

Load kernel

module

modprobe

5

6

7

8

Remove

kernel module

modprobe -r

5

6

7

8

View kernel

version

rpm -q kernel

uname -r

5

6

7

8

8

yum module remove

Change

module

streams

module_name:stream

yum module reset module:stream

8

yum module install

module:new_stream

List available

modules

yum module list

8

File systems, volumes, and disks (cont.)

File systems, volumes, and disks

TASK

Default file

system

Create/

modify disk

partitions

ext3

5

xfs

7

ssm create

7

gdisk

7

5

Mount

storage

6

copy data to new file system

fsck (look for ¡®non-contiguous

inodes¡¯)

8

7

8

7

8

6

7

8

6

7

8

6

7

8

7

8

ssm create

mkfs.filesystem_type (ext4, xfs)

mkswap

8

8

ssm_create

5

xfs_fsr

Defragment

disk space

View NFS

share

6

ext4

fdisk

parted

Format disk

partition

TASK

RHEL

5

ssm mount

Configure

NFS share

RHEL

showmount -e

mount

5

6

service nfs reload

5

6

systemctl reload nfs.service

/etc/exports

5

6

7

8

7

8

7

8

Configure

on-demand

auto-mounts

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

/etc/auto.*

8

Change file

permissions

chmod

chown

chgrp

umask (future file creation)

8

Change file

attributes

chattr

8

Change

access

control list

setfacl

8

mount

/etc/fstab

5

6

7

8

Mount and

activate swap

/etc/fstab

swapon -a

5

6

7

8

Configure

static mounts

/etc/fstab

5

6

7

8

TASK

View free disk

space

df

5

6

7

8

Trace system

calls

strace

5

6

7

8

Trace library

calls

ltrace

5

6

7

8

View logical

volume info

lvdisplay

lvs

vgdisplay

vgs

pvdisplay

pvs

Change

process

priority

nice

renice

5

6

7

8

Change

process run

location

taskset

5

6

7

8

Kill a process

kill

pkill

killall

5

6

7

8

netstat

5

6

7

8

Resource management

5

6

ssm create (if backend is lvm)

Create volume

group

ssm create (if backend is lvm)

Create logical

volume

ssm create (if backend is lvm)

lvcreate

5

6

Enlarge

volumes

formatted

with default

file system

resize2fs

5

6

vgextend

lvextend

5

6

Shrink

volumes

formatted

with default

file system

resize2fs

lvreduce

vgreduce

5

6

Check/repair

file system

ssm check

vgcreate

5

6

7

8

8

5

6

7

8

8

xfs_growfs

ssm resize

7

8

7

8

7

8

ss

tuna

View system

usage

6

8

pcp atop

top

ps

sar

iostat

vmstat

mpstat

numastat

5

iostat

XFS cannot currently be shrunk;

copy desired data to a smaller

file system.

fsck

8

8

Create

physical

volume

pvcreate

7

RHEL

7

8

8

5

6

7

8

View disk

usage

6

7

8

6

7

8

pcp-dstat

pmiostat

df

8

5

6

7

8

Networking

TASK

Configure

name

resolution

Configure

hostname

RHEL

nmcli con mod

/etc/hosts

/etc/resolv.conf

5

6

/etc/sysconfig/network

5

6

hostnamectl

/etc/hostname

nmtui

ifconfig

View network

interface info

View routes

Configure

routes

Configure

firewall

View ports/

sockets

5

8

7

8

7

8

7

8

7

8

7

8

6

nmcli dev show

teamdctl

bridge

ip addr

brctl

Configure

network

interface

5

7

6

nmcli con [add|mod|edit]

nmtui

nm-connection-editor

/etc/sysconfig/network-scripts/

ifcfg-*

5

6

7

8

ip route

5

6

7

8

system-config-network

5

6

7

8

7

8

7

8

nmcli

nmtui

nm-connection-editor

ip route add

/etc/sysconfig/route-iface

5

6

iptables and ip6tables

/etc/sysconfig/ip*tables

5

6

6

system-config-firewall

firewall-cmd

firewall-config

nftables

8

pcp-dstat--socket

8

ss

lsof

netstat

5

6

7

8

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.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download