当前位置:网站首页>shell常用命令-备忘录
shell常用命令-备忘录
2022-07-27 05:23:00 【sin_404】
1、根据端口|pid排查问题
netstat -tnlp 查看当前在用端口并显示pid
lsof -i: port 查看具体端口号被谁占用
ps -ef|grep 'pid|port' 根据pid或端口
2、查看路由转跳
mtr -r ip # 输出路由报告
mtr -c(n) ip # 发送多少包数据
mtr # my traceroute
3、系统资源自检
ifconfig -a | ip a 查看网卡
netstat -tnlp 查看网络端口
iostat 1 10 查看io使用情况 1 刷新间隔| 10 刷新次数
vmstat 1 10 查看系统整体使用情况
top命令,查看系统负载、cpu使用情况、内存使用情况,和进程列表
free -m 查看内存使用情况
dstat 查看网卡进出速率
sar -n DEV 1 10查看网络
nethogs 查看进程的网络流量
iftop 查看源ip和目标ip的网络流量
4、查找命令
locate -i path/ filename path可选变量 忽略大小写 默认模糊查询 索引有延时
find /dir -name filename 在/dir目录及其子目录下面查找名字为filename的文件
默认为当前目录, filename可以通过*符号实现模糊查询
whereis 只能用于程序名的搜索 只能检索二进制命令文件
which 在PATH变量指定的路径中,搜索某个系统命令的位置,一般用于确定命令是否存在
5、ufw 简单防火墙
ufw allow port # 开放某端口
ufw delete allow port
ufw allow from ip 允许此IP访问所有的本机端口
ufw allow proto tcp from 192.168.0.0/24 to any port 22 允许指定的IP段访问特定端口
…
6、命令行http调测
curl -H "Content-Type: application/json" -X POST -d '{"key": "value"}' http://localhost:2000/api/json
传文件
curl -H "Content-Type: application/json" -X POST -d @data.json http://localhost:2000/api/json
边栏推荐
猜你喜欢
随机推荐
Shell script delete automatically clean up files that exceed the size
Common SQL optimization methods
Li Kou's first week's wrong question set
Shell Function
数据库在终端的基础操作
Launch file of ROS operation management
jmeter简介
接口测试概念及Postman工具简介使用
Linu性能调优:面对DDOS攻击,我们如何缓解局面?
Establishment of FTP server
Stress performance test of website based on AB tool under Apache
远程访问及控制
哈希表简介
关于testng相关标签的使用
Shell脚本一键配置LAMP
Basic knowledge of English: modifying sentence elements - Part 1
About the use of TestNG related tags
where接自定义函数导致查询缓慢
兼容性测试知识点
Network troubleshooting: Ping and tracert commands









