henrydenhengst

CentOS7-services

May 4th, 2018
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.93 KB | None | 0 0
  1. # To see System V init scripts that are available on your system and the runlevels on which they start, use the chkconfig command as follows:
  2. chkconfig --list
  3. # To show all units installed on the CentOS /RHEL 7 systemd based system, along with their current states:
  4. systemctl list-unit-files
  5. systemctl list-unit-files | grep enabled
  6. # service command – list running services
  7. # The syntax is as follows for CentOS/RHEL 6.x and older (pre systemd):
  8. service --status-all
  9. service --status-all | more
  10. service --status-all | grep ntpd
  11. service --status-all | less
  12. # Print the status of any service
  13. # To print the status of apache (httpd) service:
  14. service httpd status
  15. # List all known services (configured via SysV)
  16. chkconfig --list
  17. # List service and their open ports
  18. netstat -tulpn
  19. # Turn on / off service
  20. ntsysv
  21. chkconfig service off
  22. chkconfig service on
  23. chkconfig httpd off
  24. chkconfig ntpd on
  25. # ntsysv is a simple interface for configuring runlevel services which are also configurable through chkconfig. By default, it configures the current runlevel. Just type ntsysv and select service you want to run.
  26. # A note about RHEL/CentOS 7.x with systemd
  27. # If you are using systemd based distro such as Fedora Linux v22/23/24 or RHEL/CentOS Linux 7.x+. Try the following command to list running services using the systemctl command. It control the systemd system and service manager.
  28. # To list systemd services on CentOS/RHEL 7.x+ use
  29. # The syntax is:
  30. systemctl
  31. systemctl | more
  32. systemctl | grep httpd
  33. systemctl list-units --type service
  34. systemctl list-units --type mount
  35. # To list all services:
  36. systemctl list-unit-files
  37. # To view processes associated with a particular service (cgroup), you can use the systemd-cgtop command. Like the top command, systemd-cgtop lists running processes based on their service:
  38. systemd-cgtop
  39. # To list SysV services only on CentOS/RHEL 7.x+ use (does not include native systemd services)
  40. chkconfig --list
Advertisement
Add Comment
Please, Sign In to add comment