正文
CentOS Ubantu linux中实用系统相关常用命令
小程序:扫一扫查出行
【扫一扫了解最新限行尾号】
复制小程序
【扫一扫了解最新限行尾号】
复制小程序
系统信息相关命令
-
本节内容主要是为了方便通过远程终端维护服务器时,查看服务器上当前
系统日期和时间
/
磁盘空间占用情况
/
程序执行情况
-
本小结学习的终端命令基本都是查询命令,通过这些命令对系统资源的使用情况有个了解
目标
-
时间和日期
-
date
-
cal
-
磁盘和目录空间
-
df
-
du
-
进程信息
-
ps
-
top
-
kill
01. 时间和日期
-
时间和日期
-
date
-
cal
-
-
磁盘和目录空间
-
df
-
du
-
-
进程信息
-
ps
-
top
-
kill
-
01. 时间和日期
序号 | 命令 | 作用 |
---|---|---|
01 | date | 查看系统时间 |
02 | cal |
calendar
查看日历,
-y
选项可以查看一年的日历
|
02. 磁盘信息
序号 | 命令 | 作用 |
---|---|---|
01 | df -h |
disk free
显示磁盘剩余空间
|
02 | du -h [目录名] |
disk usage
显示目录下的文件大小
|
- 选项说明
参数 | 含义 |
---|---|
-h | 以人性化的方式显示文件大小 |
03. 进程信息
-
所谓
进程
,通俗地说就是
当前正在执行的一个程序
序号 | 命令 | 作用 |
---|---|---|
01 | ps aux |
process status
查看进程的详细状况
|
02 | top | 动态显示运行中的进程并且排序 |
03 | kill [-9] 进程代号 |
终止指定代号的进程,
-9
表示强行终止
|
ps
默认只会显示当前用户通过终端启动的应用程序
-
ps
选项说明功能
选项 | 含义 |
---|---|
a | 显示终端上的所有进程,包括其他用户的进程 |
u | 显示进程的详细状态 |
x | 显示没有控制终端的进程 |
提示:使用
kill
命令时,最好只终止由当前用户开启的进程,而不要终止root
身份开启的进程,否则可能导致系统崩溃
- 要退出
top
可以直接输入q