Common Administrative Commands

Basic Configuration CentOS 6 CentOS 7
Configure Network

system-config-network

nmcli

nmtui

nm-connection-editor

Jobs & Services CentOS 6 CentOS 7
List All Services

chkconfig --list

systemctl -at service

ls /etc/systemd/system/*.service

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

List of Running Services

service --status-all

systemctl -t service --state=active

Start/Stop Service

service <name> start

service <name> stop

systemctl start <name>.service

systemctl stop <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>

systemctl is-enabled <name>

Create New Service File or Modify Configuration

chkconfig -add

systemctl daemon reload

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

Kernel, Boot & Hardware CentOS 6 CentOS 7
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

systemctl shutdown

Halt System

poweroff

systemctl poweroff

Reboot

system reboot

systemctl reboot

Configure Default Run Level/Target

/etc/inittab

systemctl set-default

Configure GRUB Bootloader

/boot/grub/grub.conf

/etc/default/grub

grub2-mkconfig

grub-set-default

File System, Volumes & Disks CentOS 6 CentOS 7
Default File System

ext4

xfs

Create/Modify Disk Partitions

fdisk

parted

fdisk

gdisk

parted

ssm create

Format Disk Partition

mkfs.filesystem_type (ext4, xfs)

mkswap

mkfs.filesystem_type (ext4, xfs)

mkswap

ssm create

Mount Storage

mount

/etc/fstab

mount

/etc/fstab

ssm mount

Create Physical Volume

pvcreate

pvcreate

ssm create (if backend is lvm)

Create Volume Group

vgcreate

vgcreate

ssm create (if backend is lvm)

Create Logical Volume

lvcreate

lvcreate

ssm create (if backend is lvm)

Enlarge Volumes Formatted with Default File System

vgextend

lvextend

resize2fs

vgextend

lvextend

xfs_growfs

ssm 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

ssm check

Configure NFS Share

/etc/exports

service nfs reload

/etc/exports

systemctl reload nfs.service

Networking CentOS 6 CentOS 7
Configure Firewall

iptables and ip6tables

/etc/sysconfig/ip*tables

system-config-firewall

firewall-cmd

firewall-config

Configure Name Resolution

/etc/hosts

/etc/resolv.conf

/etc/hosts

/etc/resolv.conf

nmcli con mod

Configure Hostname

/etc/sysconfig/network

hostnamectl

/etc/hostname

nmtui

View Network Interface Info

ip addr

ifconfig

brctl

ip addr

nmcli dev show

teamdctl

brctl

bridge

Configure Network Interface

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

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

nmcli con [add|mod|edit]

teamdctl

nmtui

nm-connection-editor

View Ports/Sockets

ss

lsof

netstat

ss

lsof

Resource Mangement CentOS 6 CentOS 7
View System Usage

top

ps

sar

iostat

netstat

ss

vmstat

mpstat

numstat

tuna

top

ps

sar

iostat

ss

vmstat

mpstat

numstat

tuna