Linux 사용자 또는 관리자 인 경우 시스템에서 서비스를 관리하는 방법을 알아야 합니다. 서비스는 백그라운드에서 실행되며 네트워킹, 인쇄, 로깅 등과 같은 필수 기능을 제공하는 프로그램입니다.
하지만 Linux(Linux) 에서 서비스를 어떻게 나열, 시작, 중지, 활성화, 비활성화 또는 다시 시작합니까 ? 대답은 systemctl 명령입니다. 이 명령은 Ubuntu(Ubuntu) 및 Debian 과 같은 (Debian)Linux 배포판을 위한 최신 시스템 및 서비스 관리자인 systemd의 일부입니다 .
Linux 초보자(Linux beginner) 이고 systemctel을 사용하여 이러한 서비스를 관리하려면 아래 단계를 따르세요.

systemctl을 사용하여 모든 서비스 나열
Linux 시스템 의 모든 서비스를 나열하려면 터미널에서 다음 명령을 실행하세요.
sudo systemctl list-units –유형 서비스
그러면 UNIT(UNIT) , LOAD , ACTIVE , SUB 및 DESCRIPTION 의 5개 열이 있는 테이블이 표시됩니다 .

UNIT 열에는 서비스의 구성 및 정의 파일인 서비스 단위 파일의 이름이 표시됩니다 . (UNIT)이 파일에는 서비스의 기능과 관리 방법에 대한 정보가 포함되어 있습니다. 설명(DESCRIPTION) 열 에서 서비스에 대한 빠른 설명을 볼 수도 있습니다 .
LOAD 열에는 서비스 단위 파일이 메모리에 로드되었는지 여부가 표시됩니다 . (LOAD)ACTIVE 열에 는(ACTIVE) 실행 중인 서비스인지 여부가 표시됩니다. 마지막으로 SUB 열에는 실행 중, 종료됨, 실패 등 서비스의 하위 상태가 표시됩니다.
–type 서비스 대신 -a 또는 –all 옵션을 사용하여 서비스뿐 아니라 모든 유형의 단위를 나열할 수도 있습니다.
(List Active) systemctl을 사용하여
활성 서비스 나열(Services)
시스템에서 현재 활성화되어 있는(실행 중인) 서비스만 보려면 Linux 터미널에서 다음 명령을 실행하세요.
sudo systemctl list-units –유형 서비스 –상태(–state) 활성
이렇게 하면 비활성(중지) 또는 실패한 서비스가 필터링됩니다.

(List Inactive) systemctl을 사용하여
비활성 서비스 나열(Services)
마찬가지로, 시스템에서 현재 비활성(중지)된 서비스만 보려면 터미널에서 다음 명령을 실행하세요.
sudo systemctl list-units –type 서비스 –상태(–state) 비활성
그러면 활성(실행 중)이거나 실패한 서비스가 필터링됩니다.

systemctl을 사용하여 실패한 서비스 나열
시스템에서 시작 또는 중지에 실패한 서비스를 보려면 터미널을 열고 다음 명령을 실행하십시오.
sudo systemctl list-units –type 서비스 –state 실패
그러면 현재 활성(실행 중) 또는 비활성(중지) 서비스가 모두 필터링됩니다.

systemctl을 사용하여 활성화된 서비스 나열
시스템 부팅 시 자동으로 시작되도록 활성화된 서비스를 확인하려면 터미널에서 다음 명령을 실행하세요.
sudo systemctl list-unit-files –type 서비스 –상태 활성화
그러면 UNIT FILE(UNIT FILE) 및 STATE 라는 두 개의 열이 있는 테이블이 표시됩니다 . UNIT FILE(UNIT FILE) 열에는 서비스 단위 파일의 이름이 표시됩니다. STATE 열에 는(STATE) 서비스 활성화 여부가 표시됩니다.

systemctl을 사용하여 비활성화된 서비스 나열
비활성화되어 시스템 부팅 시 자동으로 시작되지 않는 서비스를 확인하려면 Linux(Linux) 터미널 을 열고 다음 명령을 실행하세요.
sudo systemctl list-unit-files –type 서비스 –상태 비활성화됨
그러면 활성화되거나 마스크된 서비스가 필터링됩니다.

(Show Details)systemctl을 사용하여
서비스(Service) 세부 정보 표시
시스템의 특정 서비스에 대한 자세한 내용을 표시하려면 터미널에서 다음 명령을 실행하세요.
sudo systemctl status <서비스 이름>
Replace <<service-name>을 확인하려는 서비스 단위 파일 이름으로 바꾸세요 .

여기에는 설명, 로드 상태, 활성 상태, 하위 상태, 프로세스 ID( PID ), 메모리 사용량, CPU 사용량 및 최근 서비스 로그와 같은 정보가 표시됩니다.
status 대신 show 하위 명령을 사용하여 모든 서비스 속성을 name=value 형식으로 표시할 수도 있습니다.
systemctl을 사용하여 서비스 시작
시스템에서 중지된 서비스를 시작하려면 Linux 터미널에서 다음 명령을 실행하세요.
sudo systemctl start <서비스 이름>
Replace <<service-name>을 시작하려는 서비스 단위 파일의 이름으로 바꾸십시오.

그러면 백그라운드에서 서비스가 시작되고 프롬프트로 돌아갑니다. status 하위 명령을 사용하여 서비스가 실행 중인지 확인할 수 있습니다.
systemctl을 사용하여 서비스 중지
시스템에서 실행 중인 서비스를 중지하려면 터미널에서 다음 명령을 실행하세요.
sudo systemctl stop <서비스 이름>
Replace <<service-name>을 중지하려는 서비스 단위 파일의 이름으로 바꾸십시오.

이렇게 하면 백그라운드에서 서비스가 중지되고 프롬프트로 돌아갑니다. status 하위 명령을 사용하여 서비스가 중지되었는지 확인할 수 있습니다.
systemctl을 사용하여 서비스 다시 시작
(Want)서비스의 구성 파일을 편집하고 다시 로드하고 변경 사항을 적용하고 싶으십니까 ? 그렇게 하면 나중에 서비스를 다시 시작해야 합니다.
시스템에서 실행 중인 서비스를 다시 시작하려면 터미널을 열고 다음 명령을 실행하세요.
sudo systemctl restart <서비스 이름>
Replace <<service-name>을 다시 시작하려는 서비스 단위 파일의 이름으로 바꾸십시오 .

이렇게 하면 백그라운드에서 서비스가 중지 및 시작되고 프롬프트로 돌아갑니다. status 하위 명령을 사용하여 서비스가 실행 중인지 확인할 수 있습니다.
systemctl을 사용하여 서비스 다시 로드
일부 서비스는 중지 및 시작 없이 구성 다시 로드를 지원합니다. 서비스를 다시 로드하면 서비스를 다시 시작하지 않고도 해당 서비스의 구성 파일을 약간 변경할 수 있습니다. 이는 다시 시작하는 것보다 빠르고 방해가 적습니다.
이 기능을 지원하는 서비스를 다시 로드하려면 터미널에서 다음 systemctl 명령을 사용하십시오.
sudo systemctl reload <서비스 이름>
Replace < service-name>을 다시 로드하려는 서비스 단위 파일의 이름으로 바꾸십시오.

그러면 백그라운드에서 서비스가 다시 로드되고 프롬프트로 돌아갑니다. status 하위 명령을 사용하여 서비스가 실행 중인지 확인할 수 있습니다.
systemctl을 사용하여 서비스 활성화
시스템 부팅 시 서비스가 자동으로 시작되도록 하려면 터미널에서 다음 명령을 실행하세요.
sudo systemctl 활성화 <서비스 이름>
Replace < service-name>을 활성화하려는 서비스 단위 파일의 이름으로 바꾸세요.

그러면 서비스 단위 파일에서 /etc/systemd/system 아래 위치로 심볼릭 링크가 생성되어 systemd에게 부팅 시 서비스를 시작하라고 지시합니다.
–now 옵션을 사용하여 서비스를 동시에 활성화하고 시작할 수도 있습니다. 예를 들어:
sudo systemctl 활성화 –now <서비스 이름>

systemctl을 사용하여 서비스 비활성화
시스템 부팅 시 서비스가 자동으로 시작되지 않도록 하려면 Linux 터미널에서 다음 명령을 실행하세요.
sudo systemctl 비활성화 <서비스 이름>
Replace < service-name>을 비활성화하려는 서비스 단위 파일의 이름으로 바꾸십시오.

이렇게 하면 /etc/systemd/system에서 심볼릭 링크가 제거되어 systemd에게 부팅 시 심볼릭 링크를 시작하지 않도록 지시합니다.
–now 옵션을 사용하여 동시에 서비스를 비활성화하고 중지할 수도 있습니다.
sudo systemctl 비활성화 –now <서비스 이름>

systemctl을 사용하여 마스크된 서비스 나열
서비스를 마스킹한다는 것은 해당 유닛 파일을 /dev/null 에 연결하여 systemd에 의해 로드되거나 조작되는 것을 방지하는 것을 의미합니다. 이렇게 하면 추가 보호 계층이 추가됩니다.
시스템에서 어떤 서비스가 마스킹되어 수동 또는 자동으로 시작하거나 중지할 수 없는지 확인하려면 Linux PC 터미널에서 다음 명령을 실행하세요.
sudo systemctl list-unit-files –type 서비스 –state 마스크됨
마스킹된 서비스 목록이 목록에 표시됩니다( 상태(STATE) 열 아래에 마스킹된 목록이 표시됨).

systemctl을 사용하여 서비스 마스크
시스템에서 서비스가 시작되거나, 수동으로 또는 자동으로 중지되지 않도록 마스킹하려면 터미널에서 다음 명령을 실행하세요.
sudo systemctl 마스크 <서비스 이름>
Replace <<service-name>을 마스킹하려는 서비스 단위 파일의 이름으로 바꾸십시오 .

이는 서비스 단위 파일에서 /dev/null로의 심볼릭 링크를 생성하여 systemd에 의해 로드되거나 조작되는 것을 방지합니다.
systemctl을 사용하여 서비스 마스크 해제
이전에 마스킹된 서비스를 마스킹 해제할 수 있습니다. 그러면 /dev/null에 대한 심볼릭 링크가 제거되어 다른 곳에서 사용하고 로드할 수 있습니다.
이전에 시스템에서 마스킹된 서비스를 마스킹 해제하려면 다음 명령을 실행하세요.
sudo systemctl unmask <서비스 이름>
Replace < service-name>을 마스크 해제하려는 서비스 단위 파일의 이름으로 바꾸십시오.

Linux PC 제어
Linux PC가 systemd를 사용하여 시스템 서비스를 관리 하는 경우 systemctl 명령을 사용하여 관리할 수 있습니다. 서비스를 시작, 중지, 다시 로드, 비활성화 및 제어할 수 있으므로 Linux PC를 더 효과적으로 제어할 수 있습니다.
PC를 관리할 수 있는 또 다른 방법은 특정 파일에 대한 액세스를 제한하는 것입니다. Linux PC에서
chmod 명령을 사용하여(use the chmod command) 액세스를 허용(또는 거부) 할 수 있습니다 .
귀하의 Linux 배포판이 적합한지 확신이 없으신가요? 대신 다른 최고의 Linux 배포판을(another top Linux distribution) 사용해 보거나 휴대용 Linux 배포판을(portable Linux distro) 사용해 보시기 바랍니다. 휴대용 배포판을 사용하면 쉽게 전환할 수 있습니다.
How to List Linux Services With the systemctl Command
If you’re a Linux user or administrator, you need to know how to manage serviceѕ on your system. Services arе programs that run in the background and providе essential functionality, such as networkіng, printing, logging, and more.
But how do you list, start, stop, enable, disable, or restart services on Linux? The answer is the systemctl command. This command is part of systemd, a modern system and service manager for Linux distributions like Ubuntu and Debian.
If you’re a Linux beginner and you want to manage these services using systemctel, follow the steps below.

List All Services with systemctl
To list all the services on your Linux system, run this command in the terminal:
sudo systemctl list-units –type service
This will show you a table with five columns: UNIT, LOAD, ACTIVE, SUB, and DESCRIPTION.

The UNIT column shows the name of the service unit file, which is the service’s configuration and definition file. This file contains information on what the service does and how to manage it. You can also view a quick descriptor for the service in the DESCRIPTION column.
The LOAD column shows whether the service unit file is loaded into memory. The ACTIVE column shows if it’s a running service or not. Finally, the SUB column shows the sub-state of the service, such as running, exited, or failed.
You can also use the -a or –all option instead of –type service to list all types of units, not just services.
List Active Services With systemctl
If you only want to see the services that are currently active (running) on your system, run this command in the Linux terminal:
sudo systemctl list-units –type service –state active
This will filter out the services that are inactive (stopped) or failed.

List Inactive Services With systemctl
Similarly, if you only want to see the services that are currently inactive (stopped) on your system, run this command in the terminal:
sudo systemctl list-units –type service –state inactive
This will filter out the services that are active (running) or failed.

List Failed Services With systemctl
If you want to see the services that have failed to start or stop on your system, open the terminal and run this command:
sudo systemctl list-units –type service –state failed
This will filter out any currently active (running) or inactive (stopped) services.

List Enabled Services With systemctl
To see which services are enabled to start automatically at boot time on your system, run this command in the terminal:
sudo systemctl list-unit-files –type service –state enabled
This will show you a table with two columns: UNIT FILE and STATE. The UNIT FILE column shows the name of the service unit file. The STATE column shows whether the service is enabled or not.

List Disabled Services With systemctl
To see which services are disabled and won’t start automatically at boot time on your system, open up your Linux terminal and run this command:
sudo systemctl list-unit-files –type service –state disabled
This will filter out the services that are enabled or masked.

Show Details of a Service With systemctl
To show more details about a specific service on your system, run this command in the terminal:
sudo systemctl status <service-name>
Replace <service-name> with the name of the service unit file you want to check.

This will show you information such as the description, load state, active state, sub-state, process ID (PID), memory usage, CPU usage, and recent service logs.
You can also use the show subcommand instead of status to display all service properties in a name=value format.
Start a Service With systemctl
To start a service that is stopped on your system, run this command in your Linux terminal:
sudo systemctl start <service-name>
Replace <service-name> with the name of the service unit file you want to start

This will start the service in the background and return to the prompt. You can use the status subcommand to verify that the service is running.
Stop a Service With systemctl
To stop a service that is running on your system, run this command in the terminal:
sudo systemctl stop <service-name>
Replace <service-name> with the name of the service unit file you want to stop

This will stop the service in the background and return to the prompt. You can use the status subcommand to verify that the service is stopped.
Restart a Service With systemctl
Want to edit and reload a service’s configuration file and apply the changes? If you do, you’ll need to restart the service afterward.
To restart a service that is running on your system, open up your terminal and run this command:
sudo systemctl restart <service-name>
Replace <service-name> with the name of the service unit file you want to restart.

This will stop and start the service in the background and return to the prompt. You can use the status subcommand to verify that the service is running.
Reload a Service with systemctl
Some services support reloading their configuration without stopping and starting. Reloading a service allows you to make minor changes to those service’s configuration files without restarting them. This is faster and less disruptive than restarting.
To reload a service that supports this feature, use the following systemctl command in the terminal:
sudo systemctl reload <service-name>
Replace <service-name> with the name of the service unit file you want to reload.

This will reload the service in the background and return to the prompt. You can use the status subcommand to verify that the service is running.
Enable a Service With systemctl
To enable a service to start automatically at boot time on your system, run this command in the terminal:
sudo systemctl enable <service-name>
Replace <service-name> with the name of the service unit file you want to enable.

This will create a symbolic link from the service unit file to a location under /etc/systemd/system, which tells systemd to start it at boot time.
You can also use the –now option to enable and start a service simultaneously. For instance:
sudo systemctl enable –now <service-name>

Disable a Service With systemctl
To disable a service from starting automatically at boot time on your system, run this command in the Linux terminal:
sudo systemctl disable <service-name>
Replace <service-name> with the name of the service unit file you want to disable.

This will remove the symbolic link from /etc/systemd/system, which tells systemd not to start it at boot time.
You can also use the –now option to disable and stop a service at the same time:
sudo systemctl disable –now <service-name>

List Masked Services With systemctl
Masking a service means linking its unit file to /dev/null, which prevents it from being loaded or manipulated by systemd. This adds an additional layer of protection.
To see which services are masked and can’t be started or stopped manually or automatically on your system, run this command in your Linux PC’s terminal:
sudo systemctl list-unit-files –type service –state masked
The list of masked services will appear in a list (with masked listed under the STATE column)

Mask a Service With systemctl
Run this command in the terminal to mask a service from being started, stopped manually, or automatically on your system,:
sudo systemctl mask <service-name>
Replace <service-name> with the name of the service unit file you want to mask.

This will create the symbolic link from the service unit file to /dev/null to prevent it from being loaded or manipulated by systemd.
Unmask a Service With systemctl
You can unmask a service that’s previously been masked. This’ll remove the symbolic link to /dev/null and allow it to be used and loaded elsewhere.
To unmask a service that was previously masked on your system, run this command:
sudo systemctl unmask <service-name>
Replace <service-name> with the name of the service unit file you want to unmask.

Controlling Your Linux PC
If your Linux PC is using systemd to manage system services, you can use the systemctl command to manage them. You can start, stop, reload, disable, and control your services, giving you greater control over your Linux PC.
Another way you can manage your PC is to limit access to certain files. You can use the chmod command on your Linux PC to allow (or disallow) access.
Unsure if your Linux distro is a good fit? You should try out another top Linux distribution instead, or even give a portable Linux distro a try. Using a portable distro will let you switch between them with ease.