To check whether the current system runs init or systemd:
ps 1 ps -p 1 -o comm= ps --no-headers -o comm --pid 1 # from a script [[ `/sbin/init --version` =~ upstart ]] && echo "This system uses Upstart" [[ `systemctl` =~ -\.mount ]] && echo "This system uses systemd" [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]] && echo "This system uses SysV init"
For the highest-level status:
systemctl
For status on a specific "unit":
systemctl status httpd.service
To restart a specific "unit":
systemctl restart httpd.service
For the details that went into that "unit":
systemctl show httpd.service
To do a mass-grep:
grep -ris <SEARCH_TERM> /etc/systemd/
For the highest-level status:
service --status-all
For status on a specific service:
service httpd status
To restart a specific service:
service httpd restart
For the details that went into that service:
vim /etc/rc.d/init.d/httpd
To do a mass-grep:
grep -i <SEARCH_TERM> /etc/rc.d/init.d/* # the above does 98% of the job, but this catches a few extra files find /etc/rc.d/ -type f | xargs grep -i <SEARCH_TERM>