如何查看 Linux 中全部正在運行的服務

有許多方法和工具能夠查看 Linux 中全部正在運行的服務。大多數管理員會在 System V(SysV)初始化系統中使用 service service-name status/etc/init.d/service-name status,而在 systemd 初始化系統中使用 systemctl status service-namehtml

以上命令能夠清楚地顯示該服務是否在服務器上運行,這也是每一個 Linux 管理員都該知道的很是簡單和基礎的命令。node

若是你對系統環境並不熟悉,也不清楚系統在運行哪些服務,你會如何檢查?mysql

是的,咱們的確有必要這樣檢查一下。這將有助於咱們瞭解系統上運行了什麼服務,以及哪些是必要的、哪些須要被禁用。linux

init(初始化initialization的簡稱)是在系統啓動期間運行的第一個進程。init 是一個守護進程,它將持續運行直相當機。git

大多數 Linux 發行版都使用以下的初始化系統之一:github

  • System V 是更老的初始化系統
  • Upstart 是一個基於事件的傳統的初始化系統的替代品
  • systemd 是新的初始化系統,它已經被大多數最新的 Linux 發行版所採用

什麼是 System V(SysV)

SysV(意即 System V) 初始化系統是早期傳統的初始化系統和系統管理器。因爲 sysVinit 系統上一些長期懸而未決的問題,大多數最新的發行版都適用於 systemd 系統。sql

什麼是 Upstart 初始化系統

Upstart 是一個基於事件的 /sbin/init 的替代品,它控制在啓動時的任務和服務的開始,在關機時中止它們,並在系統運行時監控它們。apache

它最初是爲 Ubuntu 發行版開發的,但其是以適合全部 Linux 發行版的開發爲目標的,以替換過期的 System-V 初始化系統。bash

什麼是 systemd

systemd 是一個新的初始化系統以及系統管理器,它已成爲大多數 Linux 發行版中很是流行且普遍適應的新的標準初始化系統。systemctl 是一個 systemd 管理工具,它能夠幫助咱們管理 systemd 系統。服務器

方法一:如何在 System V(SysV)系統中查看運行的服務

如下命令能夠幫助咱們列出 System V(SysV) 系統中全部正在運行的服務。

若是服務不少,我建議使用文件查看命令,如 lessmore 等,以便獲得清晰的結果。

  1. # service --status-all
  2. # service --status-all | more
  3. # service --status-all | less
  1. abrt-ccpp hook is installed
  2. abrtd (pid 2131) is running...
  3. abrt-dump-oops is stopped
  4. acpid (pid 1958) is running...
  5. atd (pid 2164) is running...
  6. auditd (pid 1731) is running...
  7. Frequency scaling enabled using ondemand governor
  8. crond (pid 2153) is running...
  9. hald (pid 1967) is running...
  10. htcacheclean is stopped
  11. httpd is stopped
  12. Table: filter
  13. Chain INPUT (policy ACCEPT)
  14. num target prot opt source destination
  15. 1 ACCEPT all ::/0 ::/0 state RELATED,ESTABLISHED
  16. 2 ACCEPT icmpv6 ::/0 ::/0
  17. 3 ACCEPT all ::/0 ::/0
  18. 4 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:80
  19. 5 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:21
  20. 6 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:22
  21. 7 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:25
  22. 8 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:2082
  23. 9 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:2086
  24. 10 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:2083
  25. 11 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:2087
  26. 12 ACCEPT tcp ::/0 ::/0 state NEW tcp dpt:10000
  27. 13 REJECT all ::/0 ::/0 reject-with icmp6-adm-prohibited
  28. Chain FORWARD (policy ACCEPT)
  29. num target prot opt source destination
  30. 1 REJECT all ::/0 ::/0 reject-with icmp6-adm-prohibited
  31. Chain OUTPUT (policy ACCEPT)
  32. num target prot opt source destination
  33. iptables: Firewall is not running.
  34. irqbalance (pid 1826) is running...
  35. Kdump is operational
  36. lvmetad is stopped
  37. mdmonitor is stopped
  38. messagebus (pid 1929) is running...
  39. SUCCESS! MySQL running (24376)
  40. rndc: neither /etc/rndc.conf nor /etc/rndc.key was found
  41. named is stopped
  42. netconsole module not loaded
  43. Usage: startup.sh { start | stop }
  44. Configured devices:
  45. lo eth0 eth1
  46. Currently active devices:
  47. lo eth0
  48. ntpd is stopped
  49. portreserve (pid 1749) is running...
  50. master (pid 2107) is running...
  51. Process accounting is disabled.
  52. quota_nld is stopped
  53. rdisc is stopped
  54. rngd is stopped
  55. rpcbind (pid 1840) is running...
  56. rsyslogd (pid 1756) is running...
  57. sandbox is stopped
  58. saslauthd is stopped
  59. smartd is stopped
  60. openssh-daemon (pid 9859) is running...
  61. svnserve is stopped
  62. vsftpd (pid 4008) is running...
  63. xinetd (pid 2031) is running...
  64. zabbix_agentd (pid 2150 2149 2148 2147 2146 2140) is running...

執行如下命令,能夠只查看正在運行的服務:

  1. # service --status-all | grep running
  1. crond (pid 535) is running...
  2. httpd (pid 627) is running...
  3. mysqld (pid 911) is running...
  4. rndc: neither /etc/rndc.conf nor /etc/rndc.key was found
  5. rsyslogd (pid 449) is running...
  6. saslauthd (pid 492) is running...
  7. sendmail (pid 509) is running...
  8. sm-client (pid 519) is running...
  9. openssh-daemon (pid 478) is running...
  10. xinetd (pid 485) is running...

運行如下命令以查看指定服務的狀態:

  1. # service --status-all | grep httpd
  2. httpd (pid 627) is running...

或者,使用如下命令也能夠查看指定服務的狀態:

  1. # service httpd status
  2. httpd (pid 627) is running...

使用如下命令查看系統啓動時哪些服務會被啓用:

  1. # chkconfig --list
  1. crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  2. htcacheclean 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  3. httpd 0:off 1:off 2:off 3:on 4:off 5:off 6:off
  4. ip6tables 0:off 1:off 2:on 3:off 4:on 5:on 6:off
  5. iptables 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  6. modules_dep 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  7. mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  8. named 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  9. netconsole 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  10. netfs 0:off 1:off 2:off 3:off 4:on 5:on 6:off
  11. network 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  12. nmb 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  13. nscd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  14. portreserve 0:off 1:off 2:on 3:off 4:on 5:on 6:off
  15. quota_nld 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  16. rdisc 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  17. restorecond 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  18. rpcbind 0:off 1:off 2:on 3:off 4:on 5:on 6:off
  19. rsyslog 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  20. saslauthd 0:off 1:off 2:off 3:on 4:off 5:off 6:off
  21. sendmail 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  22. smb 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  23. snmpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  24. snmptrapd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  25. sshd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
  26. udev-post 0:off 1:on 2:on 3:off 4:on 5:on 6:off
  27. winbind 0:off 1:off 2:off 3:off 4:off 5:off 6:off
  28. xinetd 0:off 1:off 2:off 3:on 4:on 5:on 6:off
  29. xinetd based services:
  30. chargen-dgram: off
  31. chargen-stream: off
  32. daytime-dgram: off
  33. daytime-stream: off
  34. discard-dgram: off
  35. discard-stream: off
  36. echo-dgram: off
  37. echo-stream: off
  38. finger: off
  39. ntalk: off
  40. rsync: off
  41. talk: off
  42. tcpmux-server: off
  43. time-dgram: off
  44. time-stream: off

方法二:如何在 System V(SysV)系統中查看運行的服務

另一種在 Linux 系統上列出運行的服務的方法是使用 initctl 命令:

  1. # initctl list
  2. rc stop/waiting
  3. tty (/dev/tty3) start/running, process 1740
  4. tty (/dev/tty2) start/running, process 1738
  5. tty (/dev/tty1) start/running, process 1736
  6. tty (/dev/tty6) start/running, process 1746
  7. tty (/dev/tty5) start/running, process 1744
  8. tty (/dev/tty4) start/running, process 1742
  9. plymouth-shutdown stop/waiting
  10. control-alt-delete stop/waiting
  11. rcS-emergency stop/waiting
  12. readahead-collector stop/waiting
  13. kexec-disable stop/waiting
  14. quit-plymouth stop/waiting
  15. rcS stop/waiting
  16. prefdm stop/waiting
  17. init-system-dbus stop/waiting
  18. ck-log-system-restart stop/waiting
  19. readahead stop/waiting
  20. ck-log-system-start stop/waiting
  21. splash-manager stop/waiting
  22. start-ttys stop/waiting
  23. readahead-disable-services stop/waiting
  24. ck-log-system-stop stop/waiting
  25. rcS-sulogin stop/waiting
  26. serial stop/waiting

方法三:如何在 systemd 系統中查看運行的服務

如下命令幫助咱們列出 systemd 系統中全部服務:

  1. # systemctl
  2. UNIT LOAD ACTIVE SUB DESCRIPTION
  3. sys-devices-virtual-block-loop0.device loaded active plugged /sys/devices/virtual/block/loop0
  4. sys-devices-virtual-block-loop1.device loaded active plugged /sys/devices/virtual/block/loop1
  5. sys-devices-virtual-block-loop2.device loaded active plugged /sys/devices/virtual/block/loop2
  6. sys-devices-virtual-block-loop3.device loaded active plugged /sys/devices/virtual/block/loop3
  7. sys-devices-virtual-block-loop4.device loaded active plugged /sys/devices/virtual/block/loop4
  8. sys-devices-virtual-misc-rfkill.device loaded active plugged /sys/devices/virtual/misc/rfkill
  9. sys-devices-virtual-tty-ttyprintk.device loaded active plugged /sys/devices/virtual/tty/ttyprintk
  10. sys-module-fuse.device loaded active plugged /sys/module/fuse
  11. sys-subsystem-net-devices-enp0s3.device loaded active plugged 82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapter)
  12. -.mount loaded active mounted Root Mount
  13. dev-hugepages.mount loaded active mounted Huge Pages File System
  14. dev-mqueue.mount loaded active mounted POSIX Message Queue File System
  15. run-user-1000-gvfs.mount loaded active mounted /run/user/1000/gvfs
  16. run-user-1000.mount loaded active mounted /run/user/1000
  17. snap-core-3887.mount loaded active mounted Mount unit for core
  18. snap-core-4017.mount loaded active mounted Mount unit for core
  19. snap-core-4110.mount loaded active mounted Mount unit for core
  20. snap-gping-13.mount loaded active mounted Mount unit for gping
  21. snap-termius\x2dapp-8.mount loaded active mounted Mount unit for termius-app
  22. sys-fs-fuse-connections.mount loaded active mounted FUSE Control File System
  23. sys-kernel-debug.mount loaded active mounted Debug File System
  24. acpid.path loaded active running ACPI Events Check
  25. cups.path loaded active running CUPS Scheduler
  26. systemd-ask-password-plymouth.path loaded active waiting Forward Password Requests to Plymouth Directory Watch
  27. systemd-ask-password-wall.path loaded active waiting Forward Password Requests to Wall Directory Watch
  28. init.scope loaded active running System and Service Manager
  29. session-c2.scope loaded active running Session c2 of user magi
  30. accounts-daemon.service loaded active running Accounts Service
  31. acpid.service loaded active running ACPI event daemon
  32. anacron.service loaded active running Run anacron jobs
  33. apache2.service loaded active running The Apache HTTP Server
  34. apparmor.service loaded active exited AppArmor initialization
  35. apport.service loaded active exited LSB: automatic crash report generation
  36. aptik-battery-monitor.service loaded active running LSB: start/stop the aptik battery monitor daemon
  37. atop.service loaded active running Atop advanced performance monitor
  38. atopacct.service loaded active running Atop process accounting daemon
  39. avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
  40. colord.service loaded active running Manage, Install and Generate Color Profiles
  41. console-setup.service loaded active exited Set console font and keymap
  42. cron.service loaded active running Regular background program processing daemon
  43. cups-browsed.service loaded active running Make remote CUPS printers available locally
  44. cups.service loaded active running CUPS Scheduler
  45. dbus.service loaded active running D-Bus System Message Bus
  46. postfix.service loaded active exited Postfix Mail Transport Agent
  • UNIT 相應的 systemd 單元名稱
  • LOAD 相應的單元是否被加載到內存中
  • ACTIVE 該單元是否處於活動狀態
  • SUB 該單元是否處於運行狀態(LCTT 譯註:是較於 ACTIVE 更加詳細的狀態描述,不一樣的單元類型有不一樣的狀態。)
  • DESCRIPTION 關於該單元的簡短描述

如下選項可根據類型列出單元:

  1. # systemctl list-units --type service
  2. UNIT LOAD ACTIVE SUB DESCRIPTION
  3. accounts-daemon.service loaded active running Accounts Service
  4. acpid.service loaded active running ACPI event daemon
  5. anacron.service loaded active running Run anacron jobs
  6. apache2.service loaded active running The Apache HTTP Server
  7. apparmor.service loaded active exited AppArmor initialization
  8. apport.service loaded active exited LSB: automatic crash report generation
  9. aptik-battery-monitor.service loaded active running LSB: start/stop the aptik battery monitor daemon
  10. atop.service loaded active running Atop advanced performance monitor
  11. atopacct.service loaded active running Atop process accounting daemon
  12. avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
  13. colord.service loaded active running Manage, Install and Generate Color Profiles
  14. console-setup.service loaded active exited Set console font and keymap
  15. cron.service loaded active running Regular background program processing daemon
  16. cups-browsed.service loaded active running Make remote CUPS printers available locally
  17. cups.service loaded active running CUPS Scheduler
  18. dbus.service loaded active running D-Bus System Message Bus
  19. fwupd.service loaded active running Firmware update daemon
  20. getty@tty1.service loaded active running Getty on tty1
  21. grub-common.service loaded active exited LSB: Record successful boot for GRUB
  22. irqbalance.service loaded active running LSB: daemon to balance interrupts for SMP systems
  23. keyboard-setup.service loaded active exited Set the console keyboard layout
  24. kmod-static-nodes.service loaded active exited Create list of required static device nodes for the current kernel

如下選項可幫助您根據狀態列出單位,輸出與前例相似但更直截了當:

  1. # systemctl list-unit-files --type service
  2. UNIT FILE STATE
  3. accounts-daemon.service enabled
  4. acpid.service disabled
  5. alsa-restore.service static
  6. alsa-state.service static
  7. alsa-utils.service masked
  8. anacron-resume.service enabled
  9. anacron.service enabled
  10. apache-htcacheclean.service disabled
  11. apache-htcacheclean@.service disabled
  12. apache2.service enabled
  13. apache2@.service disabled
  14. apparmor.service enabled
  15. apport-forward@.service static
  16. apport.service generated
  17. apt-daily-upgrade.service static
  18. apt-daily.service static
  19. aptik-battery-monitor.service generated
  20. atop.service enabled
  21. atopacct.service enabled
  22. autovt@.service enabled
  23. avahi-daemon.service enabled
  24. bluetooth.service enabled

運行如下命令以查看指定服務的狀態:

  1. # systemctl | grep apache2
  2. apache2.service loaded active running The Apache HTTP Server

或者,使用如下命令也可查看指定服務的狀態:

  1. # systemctl status apache2
  2. apache2.service - The Apache HTTP Server
  3. Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
  4. Drop-In: /lib/systemd/system/apache2.service.d
  5. └─apache2-systemd.conf
  6. Active: active (running) since Tue 2018-03-06 12:34:09 IST; 8min ago
  7. Process: 2786 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCESS)
  8. Main PID: 1171 (apache2)
  9. Tasks: 55 (limit: 4915)
  10. CGroup: /system.slice/apache2.service
  11. ├─1171 /usr/sbin/apache2 -k start
  12. ├─2790 /usr/sbin/apache2 -k start
  13. └─2791 /usr/sbin/apache2 -k start
  14. Mar 06 12:34:08 magi-VirtualBox systemd[1]: Starting The Apache HTTP Server...
  15. Mar 06 12:34:09 magi-VirtualBox apachectl[1089]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 10.0.2.15. Set the 'ServerName' directive globally to suppre
  16. Mar 06 12:34:09 magi-VirtualBox systemd[1]: Started The Apache HTTP Server.
  17. Mar 06 12:39:10 magi-VirtualBox systemd[1]: Reloading The Apache HTTP Server.
  18. Mar 06 12:39:10 magi-VirtualBox apachectl[2786]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using fe80::7929:4ed1:279f:4d65. Set the 'ServerName' directive gl
  19. Mar 06 12:39:10 magi-VirtualBox systemd[1]: Reloaded The Apache HTTP Server.

執行如下命令,只查看正在運行的服務:

  1. # systemctl | grep running
  2. acpid.path loaded active running ACPI Events Check
  3. cups.path loaded active running CUPS Scheduler
  4. init.scope loaded active running System and Service Manager
  5. session-c2.scope loaded active running Session c2 of user magi
  6. accounts-daemon.service loaded active running Accounts Service
  7. acpid.service loaded active running ACPI event daemon
  8. apache2.service loaded active running The Apache HTTP Server
  9. aptik-battery-monitor.service loaded active running LSB: start/stop the aptik battery monitor daemon
  10. atop.service loaded active running Atop advanced performance monitor
  11. atopacct.service loaded active running Atop process accounting daemon
  12. avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack
  13. colord.service loaded active running Manage, Install and Generate Color Profiles
  14. cron.service loaded active running Regular background program processing daemon
  15. cups-browsed.service loaded active running Make remote CUPS printers available locally
  16. cups.service loaded active running CUPS Scheduler
  17. dbus.service loaded active running D-Bus System Message Bus
  18. fwupd.service loaded active running Firmware update daemon
  19. getty@tty1.service loaded active running Getty on tty1
  20. irqbalance.service loaded active running LSB: daemon to balance interrupts for SMP systems
  21. lightdm.service loaded active running Light Display Manager
  22. ModemManager.service loaded active running Modem Manager
  23. NetworkManager.service loaded active running Network Manager
  24. polkit.service loaded active running Authorization Manager

使用如下命令查看系統啓動時會被啓用的服務列表:

  1. # systemctl list-unit-files | grep enabled
  2. acpid.path enabled
  3. cups.path enabled
  4. accounts-daemon.service enabled
  5. anacron-resume.service enabled
  6. anacron.service enabled
  7. apache2.service enabled
  8. apparmor.service enabled
  9. atop.service enabled
  10. atopacct.service enabled
  11. autovt@.service enabled
  12. avahi-daemon.service enabled
  13. bluetooth.service enabled
  14. console-setup.service enabled
  15. cron.service enabled
  16. cups-browsed.service enabled
  17. cups.service enabled
  18. display-manager.service enabled
  19. dns-clean.service enabled
  20. friendly-recovery.service enabled
  21. getty@.service enabled
  22. gpu-manager.service enabled
  23. keyboard-setup.service enabled
  24. lightdm.service enabled
  25. ModemManager.service enabled
  26. network-manager.service enabled
  27. networking.service enabled
  28. NetworkManager-dispatcher.service enabled
  29. NetworkManager-wait-online.service enabled
  30. NetworkManager.service enabled

systemd-cgtop 按資源使用狀況(任務、CPU、內存、輸入和輸出)列出控制組:

  1. # systemd-cgtop
  2. Control Group Tasks %CPU Memory Input/s Output/s
  3. / - - 1.5G - -
  4. /init.scope 1 - - - -
  5. /system.slice 153 - - - -
  6. /system.slice/ModemManager.service 3 - - - -
  7. /system.slice/NetworkManager.service 4 - - - -
  8. /system.slice/accounts-daemon.service 3 - - - -
  9. /system.slice/acpid.service 1 - - - -
  10. /system.slice/apache2.service 55 - - - -
  11. /system.slice/aptik-battery-monitor.service 1 - - - -
  12. /system.slice/atop.service 1 - - - -
  13. /system.slice/atopacct.service 1 - - - -
  14. /system.slice/avahi-daemon.service 2 - - - -
  15. /system.slice/colord.service 3 - - - -
  16. /system.slice/cron.service 1 - - - -
  17. /system.slice/cups-browsed.service 3 - - - -
  18. /system.slice/cups.service 2 - - - -
  19. /system.slice/dbus.service 6 - - - -
  20. /system.slice/fwupd.service 5 - - - -
  21. /system.slice/irqbalance.service 1 - - - -
  22. /system.slice/lightdm.service 7 - - - -
  23. /system.slice/polkit.service 3 - - - -
  24. /system.slice/repowerd.service 14 - - - -
  25. /system.slice/rsyslog.service 4 - - - -
  26. /system.slice/rtkit-daemon.service 3 - - - -
  27. /system.slice/snapd.service 8 - - - -
  28. /system.slice/system-getty.slice 1 - - - -

同時,咱們可使用 pstree 命令(輸出來自 SysVinit 系統)查看正在運行的服務:

  1. # pstree
  2. init-+-crond
  3. |-httpd---2*[httpd]
  4. |-kthreadd/99149---khelper/99149
  5. |-2*[mingetty]
  6. |-mysqld_safe---mysqld---9*[{mysqld}]
  7. |-rsyslogd---3*[{rsyslogd}]
  8. |-saslauthd---saslauthd
  9. |-2*[sendmail]
  10. |-sshd---sshd---bash---pstree
  11. |-udevd
  12. `-xinetd

咱們還可使用 pstree 命令(輸出來自 systemd 系統)查看正在運行的服務:

  1. # pstree
  2. systemd─┬─ModemManager─┬─{gdbus}
  3. └─{gmain}
  4. ├─NetworkManager─┬─dhclient
  5. ├─{gdbus}
  6. └─{gmain}
  7. ├─accounts-daemon─┬─{gdbus}
  8. └─{gmain}
  9. ├─acpid
  10. ├─agetty
  11. ├─anacron
  12. ├─apache2───2*[apache2───26*[{apache2}]]
  13. ├─aptd───{gmain}
  14. ├─aptik-battery-m
  15. ├─atop
  16. ├─atopacctd
  17. ├─avahi-daemon───avahi-daemon
  18. ├─colord─┬─{gdbus}
  19. └─{gmain}
  20. ├─cron
  21. ├─cups-browsed─┬─{gdbus}
  22. └─{gmain}
  23. ├─cupsd
  24. ├─dbus-daemon
  25. ├─fwupd─┬─{GUsbEventThread}
  26. ├─{fwupd}
  27. ├─{gdbus}
  28. └─{gmain}
  29. ├─gnome-keyring-d─┬─{gdbus}
  30. ├─{gmain}
  31. └─{timer}

方法四:如何使用 chkservice 在 systemd 系統中查看正在運行的服務

chkservice 是一個管理系統單元的終端工具,須要超級用戶權限。

  1. # chkservice

要查看幫助頁面,請按下 ? ,它將顯示管理 systemd 服務的可用選項。


via: https://www.2daygeek.com/how-to-check-all-running-services-in-linux/

做者:Magesh Maruthamuthu 譯者:jessie-pang 校對:wxy

本文由 LCTT 原創編譯,Linux中國 榮譽推出

編譯自:https://www.2daygeek.com/how-to-check-all-running-services-in-linux/ 做者: Magesh Maruthamuthu
原創:LCTT https://linux.cn/article-9918-1.html 譯者: jessie-pang

本文由 LCTT 原創翻譯,Linux中國首發。也想加入譯者行列,爲開源作一些本身的貢獻麼?歡迎加入 LCTT
翻譯工做和譯文發表僅用於學習和交流目的,翻譯工做遵守 CC-BY-NC-SA 協議規定,若是咱們的工做有侵犯到您的權益,請及時聯繫咱們。
歡迎遵守 CC-BY-NC-SA 協議規定轉載,敬請在正文中標註並保留原文/譯文連接和做者/譯者等信息。
文章僅表明做者的知識和見解,若有不一樣觀點,請樓下排隊吐槽 :D

相關文章
相關標籤/搜索