• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

systemd command line reference (cheat sheet)

By admin

The systemd system and service manager are responsible for controlling how services are started, stopped and otherwise managed on Red Hat Enterprise Linux 7 systems. By offering on-demand service start-up and better transactional dependency controls, systemd dramatically reduces startup times. As a systemd user, you can prioritize critical services over less important services.

Although the systemd process replaces the init process (quite literally, /sbin/init is now a symbolic link to /usr/lib/systemd/systemd) for starting services at boot time and changing runlevels, systemd provides much more control than the init process does while still supporting existing init scripts. Here are some of the most commanly used systemd command examples:

View systemd information

Command Description
systemctl list-dependencies show a unit’s dependecies
systemctl list-sockets list the sockets
systemctl list-jobs View active systemd jobs
systemctl list-unit-files See unit files and their states
systemctl list-units Show if units are loaded/active
systemctl get-default List default target (like run level)

Working with services

Command Description
systemctl stop service Stop a running service
systemctl start service Start a service
systemctl restart service Restart a running service
systemctl reload service Reload all config files in service
systemctl daemon-reload Must run to reload changed unit files
systemctl –failed Shows services that failed to run
systemctl reset-failed Resets any units from failed state
systemctl status service See if service is running/enabled
systemctl enable service Enable a service to start on boot
systemctl disable service Disable service–won’t start at boot
systemctl show service Show properties of a service (or other units)
systemctl edit service Create snippit to drop in unit file
systemctl edit –full service Edit entire unit file for service
systemctl -H host status network Run any systemctl command remotely

Changing system states

Command Description
systemctl reboot Reboot the system (reboot.target)
systemctl poweroff Power off the system (poweroff.target)
systemctl emergency Put in emergency mode (emergency.target)
systemctl default Back to default target (multi-user.target)

Viewing log messages

Command Description
journalctl Show all collected log messages
journalctl -u network.service See network service messages
journalctl -f Follow messages as they appear
journalctl -k Show only kernel messages

Filed Under: CentOS/RHEL 7

Some more articles you might also be interested in …

  1. How to Execute Scripts/Commands using /etc/rc.d/rc.local in CentOS/RHEL 7
  2. How to Reinstall Corrupted Library with yum
  3. How to Disable “Predictable Network Interface Device Names” in CentOS/RHEL 7
  4. How to Configure Persistent Names for Tape Devices in CentOS/RHEL
  5. How To Setup mutt in CentOS/RHEL
  6. pvcreate error : Can’t open /dev/sdx exclusively. Mounted filesystem?
  7. “Failed to Start Activation of LVM2 Logical Volumes” and “Unit lvm2-activation-net.service Entered Failed State” – CentOS/RHEL 7 booting issue
  8. How to disable IPv6 on CentOS / RHEL 7
  9. How to Enable Remote Desktop to Share the Current Desktop Session in CentOS/RHEL 7
  10. CentOS / RHE 7 : How to Prevent Users from Using the Last 10 Passwords

You May Also Like

Primary Sidebar

Recent Posts

  • MySQL: how to figure out which session holds which table level or global read locks
  • Recommended Configuration of the MySQL Performance Schema
  • MySQL: Identify what user and thread are holding on to a meta data lock that is preventing other queries from running
  • MySQL: How to kill a Long Running Query using max_execution_time
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary