1、Centos下查看当前系统版本:
命令:cat /etc/redhat-release
显示:
2、Centos7查看服务器状态[root@blog-tag-gg ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
[root@blog-tag-gg ~]#
命令:systemctl status mysqld.service (将mysqld更换为您自己的服务名)
重启服务:systemctl restart mysqld.service
停止服务:systemctl stop mysqld.service
3、查看模拟进程或服务的ID号[root@blog-tag-gg ~]# systemctl status mysqld.service
● mysqld.service - LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
Active: active (running) since Mon 2021-02-08 13:50:35 CST; 3 weeks 0 days ago
Docs: man:systemd-sysv-generator(8)
Process: 3160 ExecStart=/etc/rc.d/init.d/mysqld start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/mysqld.service
├─3225 /bin/sh /www/server/mysql/bin/mysqld_safe --datadir=/www/server/data --pid-file=/www/server/data/iZ...
└─4323 /www/server/mysql/bin/mysqld --basedir=/www/server/mysql --datadir=/www/server/data --plugin-dir=/w...
Feb 08 13:50:29 iZb0piaopr2dw1Z systemd[1]: Starting LSB: start and stop MySQL...
Feb 08 13:50:35 iZb0piaopr2dw1Z mysqld[3160]: Starting MySQL......[ OK ]
Feb 08 13:50:35 iZb0piaopr2dw1Z systemd[1]: Started LSB: start and stop MySQL.
命令:pidof 服务名
4、Linux下结束进程树[root@blog-tag-gg ~]# pidof mysqld
4313
命令:killall nginx
5、查看系统负载[root@blog-tag-gg ~]# pidof nginx
3365 3364 3355
[root@blog-tag-gg ~]# killall nginx
[root@blog-tag-gg ~]# pidof nginx
[root@blog-tag-gg ~]#
命令:uptime
还可以用top命令,但uptime更简洁。
6、last命令查看登录系统的信息[root@blog-tag-gg ~]# uptime
15:44:56 up 1:30, 1 user, load average: 0.00, 0.03, 0.35
命令:last
[root@blog-tag-gg ~]# last
root pts/0 192.168.0.100 Mon Mar 1 14:16 still logged in
root pts/0 192.168.0.100 Mon Mar 1 14:15 - 14:16 (00:00)
reboot system boot 3.10.0-957.5.1.e Mon Mar 1 22:14 - 15:53 (-6:-20)
root pts/0 192.168.0.100 Mon Mar 1 13:58 - down (00:16)
root pts/0 192.168.0.100 Mon Mar 1 13:56 - 13:57 (00:00)
root pts/0 192.168.0.100 Mon Mar 1 13:53 - 13:56 (00:03)
文章评论 本文章有个评论