리눅스2023. 9. 13. 13:17

 

반달가면 이글루에서 백업 - http://bahndal.egloos.com/641551 (2020.9.1)

리눅스 systemd에서 특정 상태에 있는 서비스(service)의 목록을 확인하기 위한 방법이다.

특정 상태에 있는 서비스를 보려면 list-units 명령에 --state 옵션을 조합한다. 우선 현재 실행중인(active) 서비스 목록을 보려면 터미널창에서 아래와 같이 입력하면 되겠다.

# active 서비스 목록
systemctl list-units --state active

grep과 조합하여 특정 문자열이 포함된 서비스를 걸러낼 수도 있다.

# 활성화되어 있는 서비스중 문자열 "kernel"이 포함된 것만 골라내기
systemctl list-units --state active | grep kernel

실행하려 했으나 실패한(failed) 서비스 목록을 보려면 아래와 같이 입력하면 된다.

# failed 서비스 목록
systemctl list-units --state failed

부팅중에 특정 서비스가 제대로 실행되지 않은 경우가 있는지 확인하고 싶을 때 failed 서비스를 살펴보면 유용하다.

전체 서비스 목록과 상태(state)를  보고 싶으면 아래와 같이 입력하면 된다.

# 전체 서비스 목록
systemctl list-unit-files

활성화(enabled) 또는 비활성화(disabled) 여부를 grep 명령과 조합해서 확인해 볼 수 있다.

# disabled 서비스 목록
systemctl list-unit-files | grep disabled

728x90
Posted by 반달가면