linux 常用命令,总结起来
1、防火墙开启关闭,端口开放、关闭
firewall-cmd --zone=public --add-port=8888/tcp --permanent # 开放8888端口
firewall-cmd --zone=public --remove-port=8888/tcp --permanent #关闭8888端口
firewall-cmd --reload # 配置立即生效
firewall-cmd --zone=public --list-ports #查看防火墙所有开放的端口
systemctl start firewalld #开启防火墙
systemctl stop firewalld #关闭防火墙
firewall-cmd --state #查看防火墙状态
2、rz、sz上传下载命令
yum -y install lrzsz
rz
sz 文件名
3、解压
tar -zxvf 文件名
4、查找文件
find / name '文件名'
5、文件操作(包含日志相关)
du -h --max-depth=1
vim 文件名
tail -f 文件名
tail +20 文件名
tail -n 500 文件名
cp 文件名 指定路径
mv 文件名 指定路径
touch 文件名
mkdir 文件夹
rm 文件名
cat nohup.log | grep "错误信息提示" -C 10
sed -n '/2020-10-15 08:00:00/,/2020-10-15 08:30:00/p' logs/nohup.log.2020-10-15.log |grep 'test' -C 20
echo & grep -i 'kfclWgdList' nohup.log.2021-04-20.log -C 20 > xx1.txt
find /usr/local/project/D\:/logs/ -type f -exec grep -li "S20924662403180002" {} +
6、windows查看端口占用
netstat -aon|findstr "9999"
taskkill /T /F /PID 35924
taskkill /f /im nginx.exe
7、修改root密码
passwd