banner



How To Check Service Up In Linux

Services are essential background processes that are usually run while booting upward and close down with the OS.

If you are a sysadmin, you'll bargain with the service regularly.

If you are a normal desktop user, you may come across the need to restart a service like setting upwardly Barrier for sharing mouse and keyboard between computers. or when y'all are using ufw to setup firewall.

Today I volition testify you lot two different ways y'all tin can manage services. You'll larn to start, cease and restart services in Ubuntu or whatever other Linux distribution.

systemd vs init

Ubuntu and many other distributions these days use systemd instead of the good old init.

In systemd, you manage sevices with systemctl command.

In init, you manage service with service command.

You lot'll notice that fifty-fifty though your Linux system uses systemd, it is still able to utilize the service command (intended to be used with init organization). This is because service command is actually redirect to systemctl. Information technology'south sort of backward compatibility introduced past systemd because sysadmins were habitual of using the service command.

I'll show both systemctl and service command in this tutorial.

I am Ubuntu 18.04 here, but the procedure (no pun intended) is the same for other versions.

Method ane: Managing services in Linux with systemd

I am starting with systemd considering of the obvious reason of its widespread adoption.

1. List all services

In order to manage the services, you start need to know what services are available on your system.

You lot can use the systemd command to list all the services on your Linux arrangement:

            systemctl list-unit-files --type service -all          
systemctl list-unit-files
systemctl list-unit-files

This command will output the state of all services. The value of a service's state can be enabled, disabled, masked (inactive until mask is unset), static and generated.

Combine information technology with the grep command and yous tin display merely the running services:

            sudo systemctl | grep running          
Display running services systemctl
Display running services systemctl

At present that yous know how to reference all unlike services, you can start actively managing them.

Note: <service- proper noun> in the commands should be replaced past the name of the service y'all wish to manage (eastward.g. network-manager, ufw etc.).

two. Outset a service

To start a service in Linux, yous just need to apply its name similar this:

            systemctl start <service-proper name>          

iii. Stop a service

To stop a systemd service, you can use the stop option of systemctl command:

            systemctl cease <service-proper name>          

4. Reshowtime a service

To restart a service in Linux with systemd, you lot can apply:

            systemctl restart <service-name>          

5. Cheque the status of a service

You can confirm that you have successfully executed a certain activeness by printing the service status:

            systemctl status <service-proper noun>          

This will output information in the following manner:

systemctl status
systemctl status

That was systemd. Let's switch to init now.

Method 2: Managing services in Linux with init

The commands in init are also as simple equally system.

1. List all services

To list all the Linux services, use

            service --status-all          
service --status-all
service –condition-all

The services preceded by [ – ] are disabled and those with [ + ] are enabled.

2. Start a service

To commencement a service in Ubuntu and other distributions, utilise this control:

            service <service-name> start          

iii. Stop a service

Stopping a service is equally easy.

            service <service-name> stop          

4. Rekickoff a service

If yous want to restart a service, the command is:

            service <service-name> restart          

5. Check the status of a service

Furthermore, to bank check if your intended event was accomplished, you tin output the service status:

            service <service-proper name> status          

This will output information in the following manner:

service status
service status

This volition, most chiefly, tell y'all if a certain service is active (running) or not.

Wrapping Up

Today I detailed two very simple methods of managing services on Ubuntu or whatever other Linux organisation. I hope this commodity was helpful to you.

Which method practise you prefer? Permit us know in the comment section below!


How To Check Service Up In Linux,

Source: https://itsfoss.com/start-stop-restart-services-linux/

Posted by: simpsonprinnexparm.blogspot.com

0 Response to "How To Check Service Up In Linux"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel