1. 防火墙相关
1.1 centos7 防火墙
systemctl status firewalld.service
systemctl disable firewalld.service
systemctl stop firewalld.service
systemctl disable firewalld
1.2 centos6防火墙
service iptables status
service iptables stops
2. 环境变量
vim /etc/profile
source /etc/profile
3. 端口和进程互查
netstat -nltp | grep 9100
netstat -anp | grep 12321
sudo netstat -tuln | grep 10250
sudo lsof -i :10250
4. 文件和目录
sudo ln -s /usr/local/app/a.txt
chown -R root:root /usr/local/
chmod 777 文件名
5. 内存和CPU
top -c
ps -ef | grep java
jmap -heap pid
jmap -histo:live pid
6. 硬盘空间问题排查
df -k
du -h --max-depth=1
du -h /path/to/directory | sort -rh | head -n 10
7. 文件查看与编辑
grep "内容" *
less log
`/` 搜索关键字
`G` 跳转到最后
`n` 寻找下一个关键字
`N` 寻找上一个关键字
vi
`dd` 删除一行
`yy` 复制一行
`p` 粘贴
`u` 撤销
:%s/源字符串/目的字符串/g
8. 杀死进程
kill -9 pid
pkill 匹配的应用名
9. 远程连接sftp
sftp -oPort=port sftpUserName@sftpIp
10. 修改机器时间
date
sudo date -s "2023-07-19 10:30:00"
sudo hwclock --systohc