mirror of
https://github.com/dunwu/linux-tutorial.git
synced 2024-04-15 19:55:24 +08:00
📝 Writing docs.
This commit is contained in:
parent
bf8fb51e1b
commit
f093d37b40
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Linux 系统管理命令
|
title: Linux 系统管理
|
||||||
date: 2018/02/27
|
date: 2018/02/27
|
||||||
categories:
|
categories:
|
||||||
- linux
|
- linux
|
||||||
@ -8,22 +8,35 @@ tags:
|
|||||||
- command
|
- command
|
||||||
---
|
---
|
||||||
|
|
||||||
# Linux 系统管理命令
|
# Linux 系统管理
|
||||||
|
|
||||||
> 关键词:`reboot`, `exit`, `shutdown`, `date`, `mount`, `umount`
|
> 关键词:`reboot`, `exit`, `shutdown`, `date`, `mount`, `umount`
|
||||||
|
|
||||||
<!-- TOC depthFrom:2 depthTo:2 -->
|
<!-- TOC depthFrom:2 depthTo:3 -->
|
||||||
|
|
||||||
- [reboot](#reboot)
|
- [Linux 系统管理要点](#linux-系统管理要点)
|
||||||
- [exit](#exit)
|
- [命令常见用法](#命令常见用法)
|
||||||
- [shutdown](#shutdown)
|
- [reboot](#reboot)
|
||||||
- [date](#date)
|
- [exit](#exit)
|
||||||
- [mount](#mount)
|
- [shutdown](#shutdown)
|
||||||
- [umount](#umount)
|
- [date](#date)
|
||||||
|
- [mount](#mount)
|
||||||
|
- [umount](#umount)
|
||||||
|
|
||||||
<!-- /TOC -->
|
<!-- /TOC -->
|
||||||
|
|
||||||
## reboot
|
## Linux 系统管理要点
|
||||||
|
|
||||||
|
- 重新启动 Linux 操作系统 - 使用 [reboot](#reboot)
|
||||||
|
- 退出 shell,并返回给定值 - 使用 [exit](#exit)
|
||||||
|
- 关闭系统 - 使用 [shutdown](#shutdown)
|
||||||
|
- 查看或设置系统时间与日期 - 使用 [date](#date)
|
||||||
|
- 挂载文件系统 - 使用 [mount](#mount)
|
||||||
|
- 取消挂载文件系统 - 使用 [umount](#umount)
|
||||||
|
|
||||||
|
## 命令常见用法
|
||||||
|
|
||||||
|
### reboot
|
||||||
|
|
||||||
> reboot 命令用来重新启动正在运行的 Linux 操作系统。
|
> reboot 命令用来重新启动正在运行的 Linux 操作系统。
|
||||||
>
|
>
|
||||||
@ -36,7 +49,7 @@ reboot # 重开机。
|
|||||||
reboot -w # 做个重开机的模拟(只有纪录并不会真的重开机)。
|
reboot -w # 做个重开机的模拟(只有纪录并不会真的重开机)。
|
||||||
```
|
```
|
||||||
|
|
||||||
## exit
|
### exit
|
||||||
|
|
||||||
> exit 命令同于退出 shell,并返回给定值。在 shell 脚本中可以终止当前脚本执行。执行 exit 可使 shell 以指定的状态值退出。若不设置状态值参数,则 shell 以预设值退出。状态值 0 代表执行成功,其他值代表执行失败。
|
> exit 命令同于退出 shell,并返回给定值。在 shell 脚本中可以终止当前脚本执行。执行 exit 可使 shell 以指定的状态值退出。若不设置状态值参数,则 shell 以预设值退出。状态值 0 代表执行成功,其他值代表执行失败。
|
||||||
>
|
>
|
||||||
@ -69,7 +82,7 @@ if [ "$EXCODE" == "0" ]; then
|
|||||||
fi
|
fi
|
||||||
```
|
```
|
||||||
|
|
||||||
## shutdown
|
### shutdown
|
||||||
|
|
||||||
> shutdown 命令用来系统关机命令。shutdown 指令可以关闭所有程序,并依用户的需要,进行重新开机或关机的动作。
|
> shutdown 命令用来系统关机命令。shutdown 指令可以关闭所有程序,并依用户的需要,进行重新开机或关机的动作。
|
||||||
>
|
>
|
||||||
@ -85,7 +98,7 @@ shutdown -h now
|
|||||||
shutdown +5 "System will shutdown after 5 minutes"
|
shutdown +5 "System will shutdown after 5 minutes"
|
||||||
```
|
```
|
||||||
|
|
||||||
## date
|
### date
|
||||||
|
|
||||||
> date 命令是显示或设置系统时间与日期。
|
> date 命令是显示或设置系统时间与日期。
|
||||||
>
|
>
|
||||||
@ -151,12 +164,11 @@ difference=$(( end - start ))
|
|||||||
echo $difference seconds.
|
echo $difference seconds.
|
||||||
```
|
```
|
||||||
|
|
||||||
## mount
|
### mount
|
||||||
|
|
||||||
> mount 命令用于挂载文件系统到指定的挂载点。此命令的最常用于挂载 cdrom,使我们可以访问 cdrom 中的数据,因为你将光盘插入 cdrom 中,Linux 并不会自动挂载,必须使用 Linux mount 命令来手动完成挂载。
|
> mount 命令用于挂载文件系统到指定的挂载点。此命令的最常用于挂载 cdrom,使我们可以访问 cdrom 中的数据,因为你将光盘插入 cdrom 中,Linux 并不会自动挂载,必须使用 Linux mount 命令来手动完成挂载。
|
||||||
>
|
>
|
||||||
> 参考:http://man.linuxde.net/mount
|
> 参考:http://man.linuxde.net/mount > https://blog.csdn.net/weishujie000/article/details/76531924
|
||||||
> https://blog.csdn.net/weishujie000/article/details/76531924
|
|
||||||
|
|
||||||
示例:
|
示例:
|
||||||
|
|
||||||
@ -172,7 +184,7 @@ mount -o ro /dev/hda1 /mnt
|
|||||||
mount -o loop /tmp/image.iso /mnt/cdrom
|
mount -o loop /tmp/image.iso /mnt/cdrom
|
||||||
```
|
```
|
||||||
|
|
||||||
## umount
|
### umount
|
||||||
|
|
||||||
> umount 命令用于卸载已经挂载的文件系统。利用设备名或挂载点都能 umount 文件系统,不过最好还是通过挂载点卸载,以免使用绑定挂载(一个设备,多个挂载点)时产生混乱。
|
> umount 命令用于卸载已经挂载的文件系统。利用设备名或挂载点都能 umount 文件系统,不过最好还是通过挂载点卸载,以免使用绑定挂载(一个设备,多个挂载点)时产生混乱。
|
||||||
>
|
>
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Linux 性能管理命令
|
title: Linux 性能管理
|
||||||
date: 2018/02/27
|
date: 2018/02/27
|
||||||
categories:
|
categories:
|
||||||
- linux
|
- linux
|
||||||
@ -8,21 +8,33 @@ tags:
|
|||||||
- command
|
- command
|
||||||
---
|
---
|
||||||
|
|
||||||
# Linux 性能管理命令
|
# Linux 性能管理
|
||||||
|
|
||||||
> 关键词:`df`, `du`, `top`, `free`, `iotop`
|
> 关键词:`df`, `du`, `top`, `free`, `iotop`
|
||||||
|
|
||||||
<!-- TOC depthFrom:2 depthTo:2 -->
|
<!-- TOC depthFrom:2 depthTo:3 -->
|
||||||
|
|
||||||
- [df](#df)
|
- [Linux 性能管理要点](#linux-性能管理要点)
|
||||||
- [du](#du)
|
- [命令常见用法](#命令常见用法)
|
||||||
- [top](#top)
|
- [df](#df)
|
||||||
- [free](#free)
|
- [du](#du)
|
||||||
- [iotop](#iotop)
|
- [top](#top)
|
||||||
|
- [free](#free)
|
||||||
|
- [iotop](#iotop)
|
||||||
|
|
||||||
<!-- /TOC -->
|
<!-- /TOC -->
|
||||||
|
|
||||||
## df
|
## Linux 性能管理要点
|
||||||
|
|
||||||
|
- 查看磁盘空间 - 使用 [df](#df)
|
||||||
|
- 查看文件或目录的磁盘空间 - 使用 [du](#du)
|
||||||
|
- 实时查看系统整体运行状态(如:CPU、内存) - 使用 [top](#top)
|
||||||
|
- 查看已使用和未使用的内存 - 使用 [free](#free)
|
||||||
|
- 查看磁盘 I/O 使用状况 - 使用 [iotop](#iotop)
|
||||||
|
|
||||||
|
## 命令常见用法
|
||||||
|
|
||||||
|
### df
|
||||||
|
|
||||||
> df 命令用于显示磁盘分区上的可使用的磁盘空间。默认显示单位为 KB。可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息。
|
> df 命令用于显示磁盘分区上的可使用的磁盘空间。默认显示单位为 KB。可以利用该命令来获取硬盘被占用了多少空间,目前还剩下多少空间等信息。
|
||||||
>
|
>
|
||||||
@ -60,7 +72,7 @@ tmpfs 1032204 0 1032204 0% /dev/shm
|
|||||||
none 0 0 0 - /proc/sys/fs/binfmt_misc
|
none 0 0 0 - /proc/sys/fs/binfmt_misc
|
||||||
```
|
```
|
||||||
|
|
||||||
## du
|
### du
|
||||||
|
|
||||||
> du 命令也是查看使用空间的,但是与 df 命令不同的是:du 命令是对文件和目录磁盘使用的空间的查看,还是和 df 命令有一些区别的。
|
> du 命令也是查看使用空间的,但是与 df 命令不同的是:du 命令是对文件和目录磁盘使用的空间的查看,还是和 df 命令有一些区别的。
|
||||||
>
|
>
|
||||||
@ -112,13 +124,13 @@ root@localhost [test]# du
|
|||||||
32 scf
|
32 scf
|
||||||
```
|
```
|
||||||
|
|
||||||
## top
|
### top
|
||||||
|
|
||||||
> top 命令可以实时动态地查看系统的整体运行情况,是一个综合了多方信息监测系统性能和运行信息的实用工具。通过 top 命令所提供的互动式界面,用热键可以管理。
|
> top 命令可以实时动态地查看系统的整体运行情况,是一个综合了多方信息监测系统性能和运行信息的实用工具。通过 top 命令所提供的互动式界面,用热键可以管理。
|
||||||
>
|
>
|
||||||
> 参考:http://man.linuxde.net/top
|
> 参考:http://man.linuxde.net/top
|
||||||
|
|
||||||
## free
|
### free
|
||||||
|
|
||||||
> free 命令可以显示当前系统未使用的和已使用的内存数目,还可以显示被内核使用的内存缓冲区。
|
> free 命令可以显示当前系统未使用的和已使用的内存数目,还可以显示被内核使用的内存缓冲区。
|
||||||
>
|
>
|
||||||
@ -139,7 +151,7 @@ Mem: 2016 1973 42 0 163 1497
|
|||||||
Swap: 4094 0 4094
|
Swap: 4094 0 4094
|
||||||
```
|
```
|
||||||
|
|
||||||
## iotop
|
### iotop
|
||||||
|
|
||||||
> iotop 命令是一个用来监视磁盘 I/O 使用状况的 top 类工具。iotop 具有与 top 相似的 UI,其中包括 PID、用户、I/O、进程等相关信息。Linux 下的 IO 统计工具如 iostat,nmon 等大多数是只能统计到 per 设备的读写情况,如果你想知道每个进程是如何使用 IO 的就比较麻烦,使用 iotop 命令可以很方便的查看。
|
> iotop 命令是一个用来监视磁盘 I/O 使用状况的 top 类工具。iotop 具有与 top 相似的 UI,其中包括 PID、用户、I/O、进程等相关信息。Linux 下的 IO 统计工具如 iostat,nmon 等大多数是只能统计到 per 设备的读写情况,如果你想知道每个进程是如何使用 IO 的就比较麻烦,使用 iotop 命令可以很方便的查看。
|
||||||
>
|
>
|
@ -7,8 +7,8 @@
|
|||||||
- [Linux 文件内容查看命令](03.Linux文件内容查看编辑.md) - 关键词:`cat`, `head`, `tail`, `more`, `less`, `sed`, `vi`, `grep`
|
- [Linux 文件内容查看命令](03.Linux文件内容查看编辑.md) - 关键词:`cat`, `head`, `tail`, `more`, `less`, `sed`, `vi`, `grep`
|
||||||
- [Linux 文件压缩和解压](04.Linux文件压缩和解压.md) - 关键词:`tar`, `gzip`, `zip`, `unzip`
|
- [Linux 文件压缩和解压](04.Linux文件压缩和解压.md) - 关键词:`tar`, `gzip`, `zip`, `unzip`
|
||||||
- [Linux 用户管理](05.Linux用户管理.md) - 关键词:`groupadd`, `groupdel`, `groupmod`, `useradd`, `userdel`, `usermod`, `passwd`, `su`, `sudo`
|
- [Linux 用户管理](05.Linux用户管理.md) - 关键词:`groupadd`, `groupdel`, `groupmod`, `useradd`, `userdel`, `usermod`, `passwd`, `su`, `sudo`
|
||||||
- [Linux 系统管理命令](Linux系统管理命令.md) - 关键词:`reboot`, `exit`, `shutdown`, `date`, `mount`, `umount`
|
- [Linux 系统管理](06.Linux系统管理.md) - 关键词:`reboot`, `exit`, `shutdown`, `date`, `mount`, `umount`
|
||||||
- [Linux 性能管理命令](Linux性能管理命令.md) - 关键词:`df`, `du`, `top`, `free`, `iotop`
|
- [Linux 性能管理](07.Linux性能管理.md) - 关键词:`df`, `du`, `top`, `free`, `iotop`
|
||||||
- [Linux 进程管理命令](Linux进程管理命令.md) - 关键词:`ps`, `kill`, `systemctl`, `service`, `crontab`
|
- [Linux 进程管理命令](Linux进程管理命令.md) - 关键词:`ps`, `kill`, `systemctl`, `service`, `crontab`
|
||||||
- [Linux 网络应用命令](Linux网络应用命令.md) - 关键词:`curl`, `wget`, `telnet`, `ip`, `hostname`, `ifconfig`, `route`, `ssh`, `ssh-keygen`, `iptables`
|
- [Linux 网络应用命令](Linux网络应用命令.md) - 关键词:`curl`, `wget`, `telnet`, `ip`, `hostname`, `ifconfig`, `route`, `ssh`, `ssh-keygen`, `iptables`
|
||||||
- [Linux 网络测试命令](Linux网络测试命令.md) - 关键词:`host`, `nslookup`, `nc`/`netcat`, `dig`, `ping`, `traceroute`, `netstat`
|
- [Linux 网络测试命令](Linux网络测试命令.md) - 关键词:`host`, `nslookup`, `nc`/`netcat`, `dig`, `ping`, `traceroute`, `netstat`
|
||||||
|
Loading…
Reference in New Issue
Block a user