Using System Target on Redhat 7

Using System Target on Redhat 7

 

  • To check all active targets on the system.

[root@localhost]# systemctl list-units --type=target

 

  • To check all targets installed on the disk.

[root@localhost]# systemctl list-units --type=target --all

 

  • How to display the current default target.

[root@localhost]# systemctl get-default

 

  • Change the default target to the multi-user target

root@localhost]# systemctl set-default multi-user.target

 

  • View all available systemd configuration units.

[root@localhost]# systemctl -t help

 

  • Find the status of the httpd service.

[root@localhost]# systemctl status httpd.service

 

  • List all active service unit configuration files.

[root@localhost]# systemctl --type=service

or

[root@localhost]# systemctl list-units --type=service

 

  • Determine if the sshd service is active.

[root@localhost]# systemctl is-active sshd

 

  • Determine if the httpd service is enabled, and, if it is not, enable it.

[root@localhost]# systemctl is-enabled httpd

 

  • View enabled and disabled settings for all units of the type "service".

[root@localhost]# systemctl list-unit-files --type=service --all

 

  • List all service unit configuration files, whether they are active or not.

[root@localhost]# systemctl list-units --all

OR

[root@localhost]# systemctl list-units --type=service --all