{"id":892,"date":"2020-10-23T19:20:48","date_gmt":"2020-10-23T19:20:48","guid":{"rendered":"https:\/\/linuxways.net\/?p=892"},"modified":"2020-10-23T19:36:41","modified_gmt":"2020-10-23T19:36:41","slug":"how-to-start-stop-or-restart-services-in-ubuntu-20-04-lts","status":"publish","type":"post","link":"https:\/\/linuxways.net\/de\/ubuntu\/how-to-start-stop-or-restart-services-in-ubuntu-20-04-lts\/","title":{"rendered":"How to start, stop or restart services in Ubuntu 20.04 LTS"},"content":{"rendered":"<p>In this article, we will cover starting, stopping, and restarting services in Ubuntu 20.04. You should know how this works as it gives you more control. But, first things first, what are services? Services are background processes that run when the OS boots and end when it shuts down.<\/p>\n<h2>Managing services in Ubuntu using systemd<\/h2>\n<p>Systemd is System Management Daemon and it refers to all the libraries, packages, and utilities around daemon.<\/p>\n<h3>Viewing all services<\/h3>\n<p>Before you get started on staring, stopping, or restarting your services, you need to know the ones that are available on your system. You can see a list of all the services available on your system by using:<\/p>\n<pre>systemctl list-unit-files --type service \u2013all<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"689\" height=\"32\" class=\"wp-image-893\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-483.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-483.png 689w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-483-300x14.png 300w\" sizes=\"auto, (max-width: 689px) 100vw, 689px\" \/><\/p>\n<p>You will be able to view the services as in the image below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"672\" height=\"497\" class=\"wp-image-894\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-484.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-484.png 672w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-484-300x222.png 300w\" sizes=\"auto, (max-width: 672px) 100vw, 672px\" \/><\/p>\n<p>The state of your services can be enabled, disabled, static, masked, or generated.<\/p>\n<h3>View running services<\/h3>\n<p>To view running services, use:<\/p>\n<pre>sudo systemctl | grep running<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"556\" height=\"35\" class=\"wp-image-895\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-485.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-485.png 556w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-485-300x19.png 300w\" sizes=\"auto, (max-width: 556px) 100vw, 556px\" \/><\/p>\n<p>The result of this command is a list of running services, as shown below.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"721\" height=\"512\" class=\"wp-image-896\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-486.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-486.png 721w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-486-300x213.png 300w\" sizes=\"auto, (max-width: 721px) 100vw, 721px\" \/><\/p>\n<h3>Start a service<\/h3>\n<p>Use the command below to start a service:<\/p>\n<pre>systemctl start {service-name}<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"569\" height=\"39\" class=\"wp-image-897\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-487.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-487.png 569w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-487-300x21.png 300w\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" \/><\/p>\n<h3>Stop a service<\/h3>\n<p>Use the command below to stop a service:<\/p>\n<pre>systemctl stop {service-name}<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"539\" height=\"36\" class=\"wp-image-898\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-488.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-488.png 539w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-488-300x20.png 300w\" sizes=\"auto, (max-width: 539px) 100vw, 539px\" \/><\/p>\n<h3>Restart a service<\/h3>\n<p>Use the command below to restart a service:<\/p>\n<pre>systemctl restart {service-name}<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"558\" height=\"44\" class=\"wp-image-899\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-489.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-489.png 558w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-489-300x24.png 300w\" sizes=\"auto, (max-width: 558px) 100vw, 558px\" \/><\/p>\n<h3>Status of a service<\/h3>\n<p>Use the command below to view the status of a service:<\/p>\n<pre>systemctl status {service-name}<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"736\" height=\"79\" class=\"wp-image-900\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-490.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-490.png 736w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-490-300x32.png 300w\" sizes=\"auto, (max-width: 736px) 100vw, 736px\" \/><\/p>\n<h2>Managing services in Ubuntu using service<\/h2>\n<p>Service is a high-level command that redirects on different binaries. It is less advanced compared to systemd and is a part of init.<\/p>\n<h3>Viewing all services<\/h3>\n<p>Compared to system, the service commands are a lot simpler. To view all services use,<\/p>\n<pre>service --status-all<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"450\" height=\"37\" class=\"wp-image-901\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-491.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-491.png 450w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-491-300x25.png 300w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/p>\n<p>You will be able to view the services as in the image below:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"301\" height=\"333\" class=\"wp-image-902\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-492.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-492.png 301w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-492-271x300.png 271w\" sizes=\"auto, (max-width: 301px) 100vw, 301px\" \/><\/p>\n<p>The way they are displayed is different. <strong>[ + ]<\/strong> means the services is enabled and <strong>[ &#8211; ]<\/strong> means disabled.<\/p>\n<h3>Start a service<\/h3>\n<p>Use the command below to start a service:<\/p>\n<pre>service {service-name} start<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"487\" height=\"48\" class=\"wp-image-903\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-493.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-493.png 487w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-493-300x30.png 300w\" sizes=\"auto, (max-width: 487px) 100vw, 487px\" \/><\/p>\n<h3>Stop a service<\/h3>\n<p>Use the command below to stop a service:<\/p>\n<pre>service {service-name} stop<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"505\" height=\"49\" class=\"wp-image-904\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-494.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-494.png 505w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-494-300x29.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-494-501x49.png 501w\" sizes=\"auto, (max-width: 505px) 100vw, 505px\" \/><\/p>\n<h3>Restart a service<\/h3>\n<p>Use the command below to restart a service:<\/p>\n<pre>service {service-name} restart<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"504\" height=\"41\" class=\"wp-image-905\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-495.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-495.png 504w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-495-300x24.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-495-501x41.png 501w\" sizes=\"auto, (max-width: 504px) 100vw, 504px\" \/><\/p>\n<h3>Status of a service<\/h3>\n<p>Use the command below to view the status of a service:<\/p>\n<pre>service {service-name} status<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"206\" class=\"wp-image-906\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-496.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-496.png 731w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-496-300x85.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<h2>Managing services in Ubuntu using init<\/h2>\n<p>The init scripts for services are loaded in the directory \/etc\/init.d\/. Init stands for initialization, it is a daemon process that starts when the computer starts and ends when it shuts down. If init does not start, no process starts and the system reaches the Kernel Panic stage. It has been replaced by systemd which reduces computational overhead.<\/p>\n<h3>Start a service<\/h3>\n<p>Use the command below to start a service:<\/p>\n<pre>\/etc\/init.d\/{service name} stop<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"519\" height=\"41\" class=\"wp-image-907\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-497.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-497.png 519w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-497-300x24.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-497-501x41.png 501w\" sizes=\"auto, (max-width: 519px) 100vw, 519px\" \/><\/p>\n<h3>Stop a service<\/h3>\n<p>Use the command below to stop a service:<\/p>\n<pre>\/etc\/init.d\/{service name} stop<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"517\" height=\"46\" class=\"wp-image-908\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-498.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-498.png 517w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-498-300x27.png 300w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-498-501x46.png 501w\" sizes=\"auto, (max-width: 517px) 100vw, 517px\" \/><\/p>\n<h3>Restart a service<\/h3>\n<p>Use the command below to restart a service:<\/p>\n<pre>\/etc\/init.d\/{service name} restart<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"543\" height=\"43\" class=\"wp-image-909\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-499.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-499.png 543w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-499-300x24.png 300w\" sizes=\"auto, (max-width: 543px) 100vw, 543px\" \/><\/p>\n<h3>Status of a service<\/h3>\n<p>Use this command to view the status of a service:<\/p>\n<pre>\/etc\/init.d\/{service name} status<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" width=\"731\" height=\"243\" class=\"wp-image-910\" src=\"http:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-500.png\" srcset=\"https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-500.png 731w, https:\/\/linuxways.net\/wp-content\/uploads\/2020\/10\/word-image-500-300x100.png 300w\" sizes=\"auto, (max-width: 731px) 100vw, 731px\" \/><\/p>\n<p>And that is how you stop, start, or restart a service in Ubuntu 20.04.<\/p>\n\n\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>In this article, we will cover starting, stopping, and restarting services in Ubuntu 20.04. You should know how this works as it gives you more control. But, first&hellip;<\/p>","protected":false},"author":5,"featured_media":917,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[48],"class_list":["post-892","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ubuntu","tag-services"],"_links":{"self":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/892","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/comments?post=892"}],"version-history":[{"count":0,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/posts\/892\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media\/917"}],"wp:attachment":[{"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/media?parent=892"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/categories?post=892"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxways.net\/de\/wp-json\/wp\/v2\/tags?post=892"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}