2019-11-11 CentOS/Ubuntu查看服务/进程

2019-11-11  本文已影响0人  AK蜗牛

简单列一下。
CentOS和Ubuntu都可以用进程来查看服务,可以用

ps -aux | grep <name> 

来查看某个进程。
另一个命令是service,在Ubuntu上比较好用

root@js99:~# service --status-all
 [ - ]  acpid
 [ + ]  apparmor
 [ + ]  apport
 [ + ]  atd
 [ - ]  console-setup.sh
 [ + ]  cron
 [ - ]  cryptdisks
 [ - ]  cryptdisks-early
 [ + ]  dbus
 [ + ]  ebtables
...

CentOS上输出是这样的:

[root@CentOS7-98 axing]# service --status-all
netconsole module not loaded
Configured devices:
lo eth0
Currently active devices:
lo eth0 docker0

另一个命令是chkconfig,在ubuntu上没有这个命令,在CentOS上:

[root@CentOS7-98 axing]# chkconfig --list 

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

netconsole      0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
...

在CentOS上还可以用 systemctl list-unit-files 命令列出系统进程:

[root@CentOS7-98 axing]# systemctl list-unit-files
UNIT FILE                                     STATE   
proc-sys-fs-binfmt_misc.automount             static  
dev-hugepages.mount                           static  
dev-mqueue.mount                              static  
proc-sys-fs-binfmt_misc.mount                 static  
sys-fs-fuse-connections.mount                 static  
sys-kernel-config.mount                       static  
sys-kernel-debug.mount                        static  
tmp.mount                                     disabled
brandbot.path                                 disabled
systemd-ask-password-console.path             static  
systemd-ask-password-plymouth.path            static  
systemd-ask-password-wall.path                static  
session-c1.scope                              static  
arp-ethers.service                            disabled
auditd.service                                enabled 
autovt@.service                               enabled 
blk-availability.service                      disabled
brandbot.service                              static  
....
上一篇 下一篇

猜你喜欢

热点阅读