如何查看linux服务器运行状态?

如何查看linux服务器运行状态?,第1张

1、ps aux 或netstat -tlunp

ps是进程查看命令,netstat是端口查看命令,在Linux系统中,服务一定是有进程的,所以使用ps命令可以查看服务运行情况,另外,Linux服务多数是网络服务,所以通过netstat命令也可以查看服务运行状态。

2、service 服务名 status

比如查看httpd的Web服务的运行状态,执行service httpd status,如下图所示:

3、/sbin/service --status-all |grep "服务名"

比如查看httpd的web服务,执行 /sbin/service --status-all |grep "httpd"即可。如下图所示。

4、chkconfig --list

比如查看httpd的web服务,执行 chkconfig --list |grep "httpd"即可。如下图所示。

SysV服务管理系统 例如 RedHat6等发行版

service --status-all 查看所有服务

service servicename status 查看指定服务状态

service servicename start|stop|restart 启动|停止|重启 指定服务

systemd服务管理系统 如CentOS 7等

systemctl is-enabled servicename.service #查询服务是否开机启动

systemctl enable *.service #开机运行服务

systemctl disable *.service #取消开机运行

systemctl start *.service #启动服务

systemctl stop *.service #停止服务

systemctl restart *.service #重启服务

systemctl reload *.service #重新加载服务配置文件

systemctl status *.service #查询服务运行状态

systemctl --failed #显示启动失败的服务

在linux 5.X以及下的版本你可以通过service portmap status命令查看rpc是否启动。如果提示running,表示正在运行;如果提示stop就是关闭了。如果没有安装,则通过安装光盘里的portmap软件包即可。通过service portmap start开启。\x0d\x0a在linux 6及以上的版本中可以通过service rpcbind status命令查看rpc是否开启,提示如上\x0d\x0a如果没有安装,则通过安装光盘里的rpcbind软件包,即可。通过service rpcbind start开启。\x0d\x0a不过默认都是装着的。


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/8793631.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-21
下一篇2023-04-21

发表评论

登录后才能评论

评论列表(0条)

    保存