- Cheat Sheet and Example is command references/cheat sheets/examples for system engineers.

User Tools

Site Tools







RHEL7/CentOS7 vs RHEL6/CentOS6 Differences

Summary of differences

CentOS 7 has been changed from UNIX System V Init, which was conventionally used, to Systemd.
Therefore, the management command has changed significantly.

Item RHEL6/CentOS6 RHEL7/CentOS7
Boot init process systemd
- Move in parallel Faster booting
kernel 2.6.x-x 3.10.x-x
File System ext4 xfs
NIC eth0
Start Number is 0
eno1 : en = Ether Net , o = On bord
ens1 : en = Ether Net , s = PCI
Start Number is 1
Log rsyslog journal(Binary)とrsyslog(Text)
ntp ntpd chronyd
FW iptables firewalld or iptables (Only one can be used)
Location of runtime data after boot /var/run /run



 * Two character prefixes based on the type of interface:
 *   en -- ethernet
 *   sl -- serial line IP (slip)
 *   wl -- wlan
 *   ww -- wwan
 * Type of names:
 *   b<number>                             -- BCMA bus core number
 *   ccw<name>                             -- CCW bus group name
 *   o<index>[d<dev_port>]                 -- on-board device index number
 *   s<slot>[f<function>][d<dev_port>]     -- hotplug slot index number
 *   x<MAC>                                -- MAC address
 *   [P<domain>]p<bus>s<slot>[f<function>][d<dev_port>]
 *                                         -- PCI geographical location
 *   [P<domain>]p<bus>s<slot>[f<function>][u<port>][..][c<config>][i<interface>]
 *                                         -- USB port number chain

New Term

Unit Service Unit(.service) :Used to start the daemon
Socket Unit(.socket)
Device Unit
Mount Unit


Stop shutdown -h now
halt (Power OFF)
systemctl poweroff
systemctl halt (Stop the OS but do not turn off the power)
halt (Stop the OS but do not turn off the power)
Rebbot reboot
shutdown -r now
systemctl reboot
Syngle User Mode init S systemctl rescue
Standard runlevel change /etc/inittab Edit systemctl set-default
Standard target confirmation
who -r
systemctl get-default
Other systemctl Commands
RHEL7/CentOS7 Commands Note
systemctl list-units --type=target --all Confirm Available Targets
systemctl isolate Temporary switching of target
systemctl list-dependencies |grep target

Comparing Runlevel and Target

RHEL6/CentOS6 RunlevelRHEL7/CentOS7 TargetNote
init 0 Stop System
init Single User Mode
init Multi User Mode CUI
init Graphical Mode GUI Graphical Login
init 6 reboot
N/A Emergency Mode


Check Service

Item RHEL6/CentOS6 RHEL7/CentOS7
Service status check (individually) service SERVICE status
/etc/init.d/SERVICE status
systemctl status UNIT
Confirm service auto start setting chkconfig --list
chkconfig --list SERVICE
systemctl list-unit-files (Also show non-service)
systemctl list-unit-files -t service (Only Service)
systemctl is-enabled UNIT
enabled : auto start
disabled : not autostart
Service status check systemctl
systemctl list-units
systemctl -t service (Only services that are running)
systemctl |grep service (Only services that are running)
systemctl -t service --all (All Service)
-Active is the active service
The location of the service to be activated ls /etc/init.d/ ls /usr/lib/systemd/system/*.service
ls /etc/systemd/system/*.service
Other systemctl Command
RHEL7/CentOS7Command Note
systemctl is-active sshd
systemctl is-enabled sshd
systemctl list-units --type=service
systemctl list-units --type=service --all Inactive unit also displayed
systemctl list-unit-files --type=service
systemctl --failed --type=service

Start/Stop/Set Service

Item RHEL6/CentOS6 RHEL7/CentOS7
Start Service service SERVICE start
/etc/init.d/SERVICE start
systemctl start UNIT
Stop Service service SERVICE stop
/etc/init.d/SERVICE stop
systemctl stop UNIT
Reboot Service service SERVICE restart
/etc/init.d/SERVICE restart
systemctl restart UNIT
Reload service settings service SERVICE reload
/etc/init.d/SERVICE reload
systemctl reload UNIT
Automatic start of service chkconfig SERVICE on systemctl enable UNIT
Automatic service deactivation chkconfig SERVICE off systemctl disable UNIT
Forced termination of service kill -9 PROCESS-ID systemctl kill -s 9 UNIT
systemctl kill --signal=9 UNIT


  • If bash-completion is installed, you can tab complement with systemctl like Cisco.
    For example, after systemctl there are candidates in two tabs
  • When changing service file of systemd in RHEL 7 / CentOS 7, it is necessary to reflect it with “systemctl daemon-reload”.
  • systemtl status UNIT result shows various information.

# systemctl status sshd.service
sshd.service - OpenSSH server daemon
   Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled)
   Active: active (running) since Month 2016-05-30 06:46:08 JST; 1h 45min ago
 Main PID: 1054 (sshd)
   CGroup: /system.slice/sshd.service
           mq1054 /usr/sbin/sshd -D

 May 30 06:46:08 centos7 systemd[1]: Started OpenSSH server daemon.
 May 30 06:46:08 centos7 sshd[1054]: Server listening on port 22.
 May 30 06:46:08 centos7 sshd[1054]: Server listening on :: port 22.
 May 30 08:26:38 centos7 sshd[2592]: Accepted password for root from port 52987 ssh2

enabled It is activated at boot time
disabled Not booted at boot time
active(running) One or more processes are running
active(exited) Successful completion
active(waiting) Running but waiting for an event
failed Failed to execute
inactive It is not running


Item RHEL6/CentOS6 RHEL7/CentOS7
Host name setting file /etc/sysconfig/network /etc/hostname
Host name confirmation hostname hostname
hostnamectl status
Temporarily change the host name hostname NEW-HOSTNAME hostname NEW-HOSTNAME
Permanently change the host name Edit /etc/sysconfig/network hostnamectl set-hostname NEW-HOSTNAME
hostnamectl set-hostname test-server-01


  • Even in 7 series you can use the ifconfig, route, netsat, arp commands by installing net-tools.
  • There is no change in the setting file.
Item RHEL6/CentOS6 RHEL7/CentOS7
Interface settings /etc/sysconfig/network-scripts/ifcfg-XXXX
default gateway /etc/sysconfig/network
Static route /etc/sysconfig/static-routes
Display device list ifconfig -a nmcli device
nmcli d
*NetworkManager Requires activation
IP, MAC confirmation ifconfig
ip addr
ip a
ip addr
ip address show
nmcli dev show
Routing table display route
netsat -rn
ip r
ip ro
ip route
ip route show
ip r
ip ro
ip route
ip route show
Add routing route add default gw xx.xx.xx.xx ip route add default via xx.xx.xx.xx
Routing deleted route del default gw xx.xx.xx.xx ip route del default via xx.xx.xx.xx
Add default gateway route add default gw ip route add default via
Delete default gateway route del default gw ip route del default via
Check boot port netstat -an ss -an
ss -lp (listen port)

Clock Time, Time Zone

Clock Time

Item RHEL6/CentOS6 RHEL7/CentOS7
Time synchronization confirmation ntpq -p chronyc sources
chronyc sources -v
chronyc tracking ← check System time for difference of NTP Server

Time Zone

  • It is recommended not to edit / etc / sysconfig / clock or / etc / localtime, but to set the time zone with the timedatectl command
Item RHEL6/CentOS6 RHEL7/CentOS7
Check Time Zone date
strings /etc/localtime
timedatectl status
List Time Zone tree /usr/share/zoneinfo timedatectl list-timezones
Change Time Zone (1)/etc/localtime
See below
timedatectl set-timezone Asia/Tokyo

How to cange Time Zone in RHEL6/CentOS6

(1) /etc/localtime

Setting for system clock

# cp -p /etc/localtime /etc/
# ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
(2) /etc/sysconfig/clock

Hardware clock setting

Corresponding to the fact that the time zone does not return to UTC upon restart



Item RHEL6/CentOS6 RHEL7/CentOS7
Confirm system locale localectl status
Available locale list localectl list-locales
localectl list-locales |grep -i ja
Change system locale localectl set-locale LANG=ja_JP.utf8
Language setting file /etc/sysconfig/i18n /etc/locale.conf
Set by localectl command (see below)
Keymap /etc/sysconfig/keyboard
localectl set-keymap jp106
setting file :/etc/vconsole.conf

Even if LANG is set, LANG is overwritten by /etc/profile.d/ depending on the environment variable of the connection source terminal when ssh login is done.
For example, on the same server, LANG = C if LANG = C terminal, LANG = ja_JP.UTF-8 if LANG=UTF-8 terminal.
If you want to standardize on the server, you also need to set LANG in /etc/profile.

Example of unifying LANG on server

In /etc/profile, read /etc/locale.conf.

. /etc/locale.conf
export LANG

Even if LANG is set, LANG is overwritten by /etc/profile.d/ depending on the environment variable of the connection source, so if you want to unify it, add it to /etc/profile Also you need to set LANG.


内容 ext3/4 XFS
Create File System mkfs.ext4, mkfs.ext3 mkfs.xfs
Check File System e2fsck xfs_repair
Display File System Information dumpe2fs xfs_info
Resizing the file system resize2fs xfs_growfs
File system labeling or tuning tune2fs xfs_admin
Saving an image of a file system e2image xfs_metadump and xfs_drestore
File system backup dump and restore xfsdump and xfsrestore


  • Logs are now saved with binary journal.
  • It is also possible to set the rsyslog and save the log as text.
Item RHEL6/CentOS6 RHEL7/CentOS7
Real time display of logs tail -f /var/log/messages journalctl -f
tail -f /var/log/messages
Startup log dmesg journalctl --dmesg
Obtain log of specific service grep sshd /var/log/secure journalctl -u sshd
grep sshd /var/log/secure

How to use the journalctl command

Other systemctl command
RHEL7/CentOS7 Commands Description
journalctl -e View recent logs
journalctl -xe Show recent detail log
journalctl --disk-usage Confirm consumption capacity on disk
journalctl -b Confirm log at boot
journalctl -b -1 Confirm the previous boot log
journalctl -n 5 Display only the latest 5 lines
journalctl -p err Confirm by specifying priority
journalctl --since today Check today's log only
journalctl --since "2014-02-10 20:30:00" --until "2014:02-13 12:00:00"
journal -o verbose
journalctl _SYSTEMD_UNIT=sshd.service

os/linux/note/rhel7-vs-rhel6.html.txt · Last modified: 2024/06/15 by admin

Page Tools