Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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:
- chkconfig --list
- # To show all units installed on the CentOS /RHEL 7 systemd based system, along with their current states:
- systemctl list-unit-files
- systemctl list-unit-files | grep enabled
- # service command – list running services
- # The syntax is as follows for CentOS/RHEL 6.x and older (pre systemd):
- service --status-all
- service --status-all | more
- service --status-all | grep ntpd
- service --status-all | less
- # Print the status of any service
- # To print the status of apache (httpd) service:
- service httpd status
- # List all known services (configured via SysV)
- chkconfig --list
- # List service and their open ports
- netstat -tulpn
- # Turn on / off service
- ntsysv
- chkconfig service off
- chkconfig service on
- chkconfig httpd off
- chkconfig ntpd on
- # 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.
- # A note about RHEL/CentOS 7.x with systemd
- # 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.
- # To list systemd services on CentOS/RHEL 7.x+ use
- # The syntax is:
- systemctl
- systemctl | more
- systemctl | grep httpd
- systemctl list-units --type service
- systemctl list-units --type mount
- # To list all services:
- systemctl list-unit-files
- # 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:
- systemd-cgtop
- # To list SysV services only on CentOS/RHEL 7.x+ use (does not include native systemd services)
- chkconfig --list
Advertisement
Add Comment
Please, Sign In to add comment