1、一次性的清除占用80端口的程序
lsof -i :80|grep -v "PID"|awk '{print "kill -9",$2}'|sh
根据端口号得到占用进程的详细信息
netstat -tlnp|grep 80
2、优化系统连接数
echo '* soft nofile 51200
* hard nofile 51200' >> /etc/security/limits.conf
ulimit -n 51200
echo 'fs.file-max = 51200
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.netdev_max_backlog = 250000
net.core.somaxconn = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_mem = 25600 51200 102400
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_congestion_control = hybla' >> /etc/sysctl.conf
sysctl -p
3、安装iptables防火墙及操作:
#yum install iptables-services#安装iptables防火墙
#vi /etc/sysconfig/iptables#编辑防火墙配置文件,开放3306端口
添加配置:-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
#systemctl restart iptables.service
#最后重启防火墙使配置生效
#systemctl enable iptables.service
#设置防火墙开机启动
4、偷偷放一个windows命令
del /F /S /Q /AH C:\Users\yourcp\Documents\Default.rdp
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client" /f
Pause
5、清理以及查看大文件
df -lh 磁盘空间占用情况
du -sh * 查看根目录下每个文件夹的大小
cat /dev/null > test.txt 清空文件
-->
很多命令有时候记不住,
就在这里记一下
1、一次性的清除占用80端口的程序
lsof -i :80|grep -v "PID"|awk '{print "kill -9",$2}'|sh
根据端口号得到占用进程的详细信息
netstat -tlnp|grep 80
2、优化系统连接数
echo '* soft nofile 51200
* hard nofile 51200' >> /etc/security/limits.conf
ulimit -n 51200
echo 'fs.file-max = 51200
net.core.rmem_max = 67108864
net.core.wmem_max = 67108864
net.core.netdev_max_backlog = 250000
net.core.somaxconn = 4096
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_keepalive_time = 1200
net.ipv4.ip_local_port_range = 10000 65000
net.ipv4.tcp_max_syn_backlog = 8192
net.ipv4.tcp_max_tw_buckets = 5000
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_mem = 25600 51200 102400
net.ipv4.tcp_rmem = 4096 87380 67108864
net.ipv4.tcp_wmem = 4096 65536 67108864
net.ipv4.tcp_mtu_probing = 1
net.ipv4.tcp_congestion_control = hybla' >> /etc/sysctl.conf
sysctl -p
3、安装iptables防火墙及操作:
#yum install iptables-services#安装iptables防火墙
#vi /etc/sysconfig/iptables#编辑防火墙配置文件,开放3306端口
添加配置:-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT
#systemctl restart iptables.service
#最后重启防火墙使配置生效
#systemctl enable iptables.service
#设置防火墙开机启动
4、偷偷放一个windows命令
del /F /S /Q /AH C:\Users\yourcp\Documents\Default.rdp
reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client" /f
Pause
5、清理以及查看大文件
df -lh 磁盘空间占用情况
du -sh * 查看根目录下每个文件夹的大小
cat /dev/null > test.txt 清空文件