首頁 > 軟體

如何檢視 Linux 中所有正在執行的服務

2020-06-16 16:49:10

有許多方法和工具可以檢視 Linux 中所有正在執行的服務。大多數管理員會在 System V(SysV)初始化系統中使用 service service-name status/etc/init.d/service-name status,而在 systemd 初始化系統中使用 systemctl status service-name

以上命令可以清楚地顯示該服務是否在伺服器上執行,這也是每個 Linux 管理員都該知道的非常簡單和基礎的命令。

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

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

init(初始化initialization的簡稱)是在系統啟動期間執行的第一個進程。init 是一個守護行程,它將持續執行直至關機。

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

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

 

什麼是 System V(SysV)

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

 

什麼是 Upstart 初始化系統

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

它最初是為 Ubuntu 發行版開發的,但其是以適合所有 Linux 發行版的開發為目標的,以替換過時的 System-V 初始化系統。

 

什麼是 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:Firewallisnot running.
  34. irqbalance (pid 1826)is running...
  35. Kdumpis 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 modulenot 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 215021492148214721462140)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. nscd0: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. sshd0: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 82540EMGigabitEthernetController(PRO/1000 MT DesktopAdapter)
  12. -.mount loaded active mounted RootMount
  13. dev-hugepages.mount loaded active mounted HugePagesFileSystem
  14. dev-mqueue.mount loaded active mounted POSIX MessageQueueFileSystem
  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-termiusx2dapp-8.mount loaded active mounted Mount unit for termius-app
  22. sys-fs-fuse-connections.mount loaded active mounted FUSE ControlFileSystem
  23. sys-kernel-debug.mount loaded active mounted DebugFileSystem
  24. acpid.path loaded active running ACPI EventsCheck
  25. cups.path loaded active running CUPS Scheduler
  26. systemd-ask-password-plymouth.path loaded active waiting ForwardPasswordRequests to PlymouthDirectoryWatch
  27. systemd-ask-password-wall.path loaded active waiting ForwardPasswordRequests to WallDirectoryWatch
  28. init.scope loaded active running SystemandServiceManager
  29. session-c2.scope loaded active running Session c2 of user magi
  30. accounts-daemon.service loaded active running AccountsService
  31. acpid.service loaded active running ACPI event daemon
  32. anacron.service loaded active running Run anacron jobs
  33. apache2.service loaded active running TheApache 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,InstallandGenerateColorProfiles
  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-BusSystemMessageBus
  46. postfix.service loaded active exited PostfixMailTransportAgent
  • UNIT 相應的 systemd 單元名稱
  • LOAD 相應的單元是否被載入到記憶體中
  • ACTIVE 該單元是否處於活動狀態
  • SUB 該單元是否處於執行狀態(LCTT 譯註:是較於 ACTIVE 更加詳細的狀態描述,不同的單元型別有不同的狀態。)
  • DESCRIPTION 關於該單元的簡短描述

以下選項可根據型別列出單元:

  1. #systemctllist-units --type service
  2. UNIT LOAD ACTIVE SUB DESCRIPTION
  3. accounts-daemon.service loaded active running AccountsService
  4. acpid.service loaded active running ACPI event daemon
  5. anacron.service loaded active running Run anacron jobs
  6. apache2.service loaded active running TheApache 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,InstallandGenerateColorProfiles
  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-BusSystemMessageBus
  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 Createlist of required static device nodes for the current kernel

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

  1. #systemctllist-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 TheApache HTTP Server

或者,使用以下命令也可檢視指定服務的狀態:

  1. #systemctl status apache2
  2. apache2.service -TheApache 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 Tue2018-03-0612:34:09 IST;8min ago
  7. Process:2786ExecReload=/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. Mar0612:34:08 magi-VirtualBoxsystemd[1]:StartingTheApache HTTP Server...
  15. Mar0612:34:09 magi-VirtualBox apachectl[1089]: AH00558: apache2:Couldnot 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. Mar0612:39:10 magi-VirtualBoxsystemd[1]:ReloadedTheApache HTTP Server.

執行以下命令,只檢視正在執行的服務:

  1. #systemctl|grep running
  2. acpid.path loaded active running ACPI EventsCheck
  3. cups.path loaded active running CUPS Scheduler
  4. init.scope loaded active running SystemandServiceManager
  5. session-c2.scope loaded active running Session c2 of user magi
  6. accounts-daemon.service loaded active running AccountsService
  7. acpid.service loaded active running ACPI event daemon
  8. apache2.service loaded active running TheApache 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,InstallandGenerateColorProfiles
  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-BusSystemMessageBus
  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 LightDisplayManager
  22. ModemManager.service loaded active running ModemManager
  23. NetworkManager.service loaded active running NetworkManager
  24. polkit.service loaded active running AuthorizationManager

使用以下命令檢視系統啟動時會被啟用的服務列表:

  1. #systemctllist-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. ControlGroupTasks%CPU MemoryInput/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中國 榮譽推出

Linux公社的RSS地址:https://www.linuxidc.com/rssFeed.aspx

本文永久更新連結地址https://www.linuxidc.com/Linux/2018-08/153512.htm


IT145.com E-mail:sddin#qq.com