防火墙
IpTables设置
丢弃外部所有的PING请求,也可使用REJECT拒绝请求
iptables -I INPUT -p icmp -j DROP
根据规则号删除规则
iptables -D INPUT 7
查看规则(号)
iptables -nvL --line-number
开启22端口
iptables -A INPUT -p tcp --dport 22 -j ACCEPT
默认阻断所有外部连接
iptables -P INPUT DROP/ACCEPT
iptables添加多端口
-A INPUT -p tcp -m multiport -dport 21:25,135:139 -j DROP
UFW
状态
ufw status
查看规则
ufw status numberd
添加允许端口
ufw allow 443/tcp
启用
ufw enable
删除
ufw delete allow 443/tcp
ufw allow https
ufw allow 7100:7200/tcp
ufw allow from 1.2.3.4
ufw allow from 64.63.62.61 to any port 22
ufw allow from 192.168.1.0/24 to any port 3306
ufw allow in on eth2 to any port 3306
ufw deny from 23.24.25.0/24
ufw deny from 23.24.25.0/24 to any port 80
ufw delete 3
ufw disable
重置,会删除所有规则并禁用ufw
ufw reset
sudo ufw default allow outgoing
sudo ufw default deny incoming
a regular expression
禁用ICMP
/etc/ufw/before.rules
#允许
-A ufw-before-input -p icmp --icmp-type destination-unreachable -j ACCEPT
-A ufw-before-input -p icmp --icmp-type source-quench -j ACCEPT
-A ufw-before-input -p icmp --icmp-type time-exceeded -j ACCEPT
-A ufw-before-input -p icmp --icmp-type parameter-problem -j ACCEPT
-A ufw-before-input -p icmp --icmp-type echo-request -j ACCEPT
#允许
-A ufw-before-input -p icmp --icmp-type destination-unreachable -j DROP
-A ufw-before-input -p icmp --icmp-type source-quench -j DROP
-A ufw-before-input -p icmp --icmp-type time-exceeded -j DROP
-A ufw-before-input -p icmp --icmp-type parameter-problem -j DROP
-A ufw-before-input -p icmp --icmp-type echo-request -j DROP
CPU信息
cat /proc/cpuinfo
查看内核版本
uname -r
uname -a
查看发行版本
lsb_release -a
查看架构
dpkg --print-architecture
arch
解压
tar zxvf file
后台进程
参考
任务进入后台运行步骤
- 命令的尾部加上符号&,启动的进程就会成为"后台任务"。
- 如果要让正在运行的"前台任务"变为"后台任务",可以先按ctrl + z
- 然后执行bg命令让最近一个暂停的"后台任务"继续执行
- disown,从后台任务jobs中移除
./frps -c frps.ini
Ctrl+Z
bg
disown
apt
/etc/apt/source.list——源文件
sudo apt-get update && sudo apt-get install -f && sudo apt-get upgrade
user
su - steam
usermod -aG sudo username
adduser name
deluser name
网络
//查看端口占用情况
lsof -i:27015
安装ping工具
apt-get install iputils-ping
speedtest
wget https://raw.github.com/sivel/speedtest-cli/master/speedtest.py
chmod a+rx speedtest.py
mv speedtest.py /usr/local/bin/speedtest
chown root:root /usr/local/bin/speedtest
chmod a+rx file
标签:--,常用命令,Linux,input,icmp,type,ufw,before From: https://www.cnblogs.com/a48908112/p/17103395.html