how to get list of running services on sles 15
- User
how to get list of running services on sles 15
- Assistant
To get a list of running services on SUSE Linux Enterprise Server (SLES) 15, you can use the
systemctlcommand, which is part of systemd, the init system used by SLES 15.Here are a few commands you can use:
-
List all running services:
systemctl list-units --type=service --state=running -
List all services (including inactive ones):
systemctl list-units --type=service -
Get the status of a specific service: If you want to check the status of a specific service, you can use:
systemctl status <service-name> -
Get a summary of all services: To view a summary of all services and their states, you can use:
systemctl --type=service -
Check enabled services: If you're interested in services that are enabled to start at boot:
systemctl list-unit-files --type=service --state=enabled
These commands should provide you with detailed information about the running services on your SLES 15 system.
-
- User
how to restart service on sles 15
- Assistant
To restart a service on SUSE Linux Enterprise Server (SLES) 15, you can use the
systemctlcommand, which is part of the systemd init system. Here’s how you can do it:-
Restart a specific service: Use the following command, replacing
<service-name>with the name of the service you want to restart:sudo systemctl restart <service-name>For example, to restart the
httpdservice (Apache), you would run:sudo systemctl restart httpd -
Check the status of the service (optional): After restarting the service, you might want to check its status to ensure that it has restarted successfully:
sudo systemctl status <service-name> -
Enable a service to start on boot (if needed): If you want to make sure that the service starts automatically on boot, you can enable it:
sudo systemctl enable <service-name>
Example
Here’s a complete example for restarting the
sshservice:sudo systemctl restart sshd sudo systemctl status sshdMake sure you have the necessary privileges (typically root or sudo access) to perform these operations.
-