用户管理篇
新建用户
1
2
3
|
# 默认家目录/home/cindy和组cindy
adduser cindy
# 可以通过-d指定家目录,-g指定组
|
删除用户
1
2
|
# 这种删除方法默认是不删除用户的家目录,容易造成隐患。建议加上-r,用于删除家目录和邮箱
userdel cindy
|
修改用户密码
服务器状态篇
查看ip
1
2
3
4
|
ip ad [show] [具体要查看的,etho]
# 如果有虚拟ip(vip)绑定,则也可以通过此命令查看到
ipconfig
|
查看系统版本
1、查看发行版本(适用所有linux系统)
lsb_release -a
2、查看Linux内核版本
uname -a 和 cat /proc/version
1
2
3
4
5
6
7
8
9
10
|
[cindy@iZbp15qc4wmx335c268l5mZ ~]$ lsb_release -a
LSB Version: :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description: CentOS Linux release 7.8.2003 (Core)
Release: 7.8.2003
Codename: Core
[cindy@iZbp15qc4wmx335c268l5mZ ~]$ uname -a
Linux iZbp15qc4wmx335c268l5mZ 3.10.0-1127.19.1.el7.x86_64 #1 SMP Tue Aug 25 17:23:54 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
[cindy@iZbp15qc4wmx335c268l5mZ ~]$ cat /proc/version
Linux version 3.10.0-1127.19.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) ) #1 SMP Tue Aug 25 17:23:54 UTC 2020
|
服务状态篇
查看服务状态
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
systemctl status 服务名
[cindy@iZbp15qc4wmx335c268l5mZ ~]$ systemctl status mysqld
● mysqld.service - LSB: start and stop MySQL
Loaded: loaded (/etc/rc.d/init.d/mysqld; bad; vendor preset: disabled)
Active: active (exited) since Mon 2022-11-07 20:24:30 CST; 7 months 24 days ago
Docs: man:systemd-sysv-generator(8)
Warning: Journal has been rotated since unit was started. Log output is incomplete or unavailab
le.
# 除了查看,还可以用systemctl来修改服务状态
systemctl start service_name
systemctl stop service_name
systemctl restart service_name
systemctl disable service_name # 取消开机自启动
|
服务状态包括:
- loaded ##系统服务已经初始化完成,加载过配置
- active(running) ##正有一个或多个程序正在系统中执行, vsftpd就是这种模式
- atcive(exited) ##僅執行一次就正常結束的服務, 目前並沒有任何程序在系統中執行
- atcive(waiting) ##正在執行當中,不過還再等待其他的事件才能继续处理
- inactive ##服务关闭
- enbaled ##服务开机启动
- disabled ##服务开机不自启
- static ##服务开机启动项不可被管理
- failed ##系统配置错误
https://blog.csdn.net/sky__man/article/details/78178821