如何查看 Linux 中所有正在运行的服务

时间:2021-08-24 23:27:37

有许多方法和工具可以查看 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: 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

如何查看 Linux 中所有正在运行的服务

要查看帮助页面,请按下 ? ,它将显示管理 systemd 服务的可用选项。

如何查看 Linux 中所有正在运行的服务


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