服务器方面
磁盘读写速度
一、测试写速度:
time dd if=/dev/zero of=/tmp/test bs=8k count=1000000
![](https://i-blog.csdnimg.cn/blog_migrate/0604ad361b9da9274b9c886925bfbbb8.png)
测试结果为924M/s
二、测试读速度:
time dd if=/tmp/test of=/dev/null bs=8k
![](https://i-blog.csdnimg.cn/blog_migrate/90e4ba36b1db2887476a179ee0d08206.png)
三、测试读写速度:
time dd if=/tmp/test of=/var/test bs=64k
![](https://i-blog.csdnimg.cn/blog_migrate/43e9ec0752a9c9606ce7a70f3babea35.png)
测试结果为463M/s
四、参数说明
①、time有计时作用,dd用于复制,从if读出,写到of;
②、if=/dev/zero不产生IO,因此可以用来测试纯写速度;
③、同理of=/dev/null不产生IO,可以用来测试纯读速度;
④、将/tmp/test拷贝到/var则同时测试了读写速度;
⑤、bs是每次读或写的大小,即一个块的大小,count是读写块的数量。
查看服务器uuid
nmcli con show #(前提是NetworkManager启动状态)
![](https://i-blog.csdnimg.cn/blog_migrate/f25b307f9d9a2969393177a9ed7ab9cf.png)
查看服务器内存情况
free -mh
total = used + free + buff/cache
available = free + buff/cache(部分)
buff: 写 IO 缓存
cache: 读 IO 缓存
total:系统的物理内存总量,total = used + free
used:已使用的物理内存,used = shared + buffers + cached + (-/+ buffers/cache那栏的used)
free:空闲的物理内存,即既没有被进程使用,也没有用作操作系统的buffers和cached。
shared:共享内存用量,如存放共享库。
buffers:用于缓冲操作系统的目录文件,inode的值,如使用ls命令查看大目录时,这个值会增加
cached:用于操作系统页缓存,主要用于缓存已打开的文件。操作系统为了避免频繁的磁盘读写操作,会尽可能使用空闲的内存来缓存已打开的文件,即从磁盘读取出来的文件。如果频繁进行文件读写操作,则这个值会增大。
![](https://i-blog.csdnimg.cn/blog_migrate/de3909facf736e50c4bc29e0af1c3981.png)
查看服务器磁盘情况
df -h
![](https://i-blog.csdnimg.cn/blog_migrate/aaa789b759021024cf99a534d75d4786.png)
查看服务器路由表
netstat -rn #-r此标志用于显示内核路由表;-n此标志用于显示数字地址
![](https://i-blog.csdnimg.cn/blog_migrate/55788e2f92743ac74264538566226e57.png)
查看逻辑CPU数目
cat /proc/cpuinfo | grep "processor" | wc -l
![](https://i-blog.csdnimg.cn/blog_migrate/6ee344f99cc0751cab93d2d6e913599e.png)
查看操作系统版本
cat /etc/redhat-release
![](https://i-blog.csdnimg.cn/blog_migrate/b3b24faf8907c08a704ddc141f7d4049.png)
列出所有网卡
ifconfig -a
![](https://i-blog.csdnimg.cn/blog_migrate/a4dfbc6c5fe3a3ee3ab1e60d01267bc2.png)
查看文件占用大小
du -sh *
• 查看各个文件占用内存情况(仅显示总计):du -sh *
• 显示目录和文件所占空间:du
• 显示指定文件所占空间:du 文件名
![](https://i-blog.csdnimg.cn/blog_migrate/30bd05bd5056dd6a1f71263ed4f52cca.png)
防火墙
查看防火墙状态:
sudo systemctl status firewalld;
关闭防火墙命令:
sudo systemctl stop firewalld;
打开防火墙命令:
sudo systemctl start firewalld;
添加指定需要开放的端口:
firewall-cmd --add-port=123/tcp --permanent
移除端口:
firewall-cmd --permanent --remove-port=123/tcp
重载入添加的端口:
firewall-cmd --reload
查看所有建立服务的端口
netstat -an | grep tcp
查看所有建立服务的端口
netstat -an | grep ESTABLISHED
查找某个文件
find / -name file
![](https://i-blog.csdnimg.cn/blog_migrate/0af6df4cbfdcb2c7d6bc570cde1a3a27.png)
查看服务器系统日志
tail -f /var/log/messages
动态查看后十行日志:
tail -f xxxx.log
查看后十行日志:
tail -n 10 xxxx.log
查看前十行日志:
head -n 10 xxxx.log
![](https://i-blog.csdnimg.cn/blog_migrate/c48c78612c5a3debf0e6f6c639c023f6.png)
查看服务器的DNS解析列表
cat /etc/resolv.conf
![](https://i-blog.csdnimg.cn/blog_migrate/be948821994f4797dead805fcfe73ac7.png)