LINUX常用命令

史沛思
2022-11-09 / 0 评论 / 71 阅读 / 正在检测是否收录...

LINUX基础

sudo -i ##切换root
apt update ##检查包更新
apt upgrade ##执行包更新
ss -tulpn | grep 53 ##查看端口占用
yum install wget ##yum安装wget
apt-get install wget ##apt安装wget
apt --fix-broken install
apt-get install iperf3 ##apt安装iperf3
iperf3 -s ##开启服务端
iperf3 -c 22.33.44.55 ##客户端默认连接
iperf3 -s -p 114514 ##服务器指定端口114514
iperf3 -c 23.106.80.18 -p 35009 -t 50 ##客户端指定连接114514端口 50连接次?
apt --fix-broken install
apt-get install curl ##安装curl
#### 测试端口连通性
curl ip:port
wget ip:port
telnet ip port
ssh -v -p port username@ip
ssh -v -p 22 [email protected]
-v 调试模式(会打印日志).
-p 指定端口
username:远程主机的登录用户
ip:远程主机
## 安装wget:yum -y install wget
换源:    wget git.io/superupdate.sh
站长工具:http://ping.chinaz.com/
编辑hosts:vi /etc/hosts

apt-get install lsof  ##安装lsof命令
lsof -i:443      ##利用lsof命令查看端口占用的进程号
kill -9 8888      ##此处的8888为进程PID号

防火墙

firewall
firewall-cmd --zone=public --add-port=114514/tcp --permanent ##开启114514端口
firewall-cmd --zone=public --permanent --add-service=http ##开启80端口
firewall-cmd --zone=public --permanent --add-service=https ##开启443端口
firewall-cmd --reload ##重载配置
systemctl stop firewalld.service ##停止firewalld服务stop/start/retart
systemctl disable firewalld.service ##关闭firewalld服务disable/enable
iptables
apt-get install iptables  ##安装iptables
iptables -I INPUT -p tcp --dport 114514 -j ACCEPT ##放行114514端口
iptables-save  ##保存防火墙规则,重启失效
apt-get install iptables-persistent ##安装iptables-persistent
netfilter-persistent save  ##保存规则持续生效
netfilter-persistent reload ##重载配置
iptables -L  ##查看防火墙规则

Docker

docker container ls ##查看所有正在运行的 docker 
docker logs -f dockername ##查看选定 docker 的 log
docker rm -f dockername ##删除指定 docker
docker system df ##查看容器使用的磁盘空间
docker system prune -a ##对 docker 进行全面垃圾回收
docker logs --tail=100 ss-rust ##docker查看100行日志
service docker restart ##重启docker服务
0

评论 (0)

取消