Linux集腋成裘
这个 page 记录了Linux的点点滴滴。以便日后整理
-
在 debian 中,脚本运行出现错误 “can’t shift many” ,应该是 /bin/sh 的指向 dash 的错误,可以在 dpkg-reconfig dash 设置为指向 bash
-
一个命令完成压缩
tar cvf - aaa/ | gzip -qc > aaa.tar.gz
打包压缩aaa/
或者,tar -c dir/ | bzip2 > dir.tar.bz2
在 bash 总的-
例如:vim -
,tar cvf - aaa
,gzip -
-
$_
bash 中的特殊参数, 保存前一个执行命令的最后一个参数。例如:mkdir aaa/bbb/ccc && cp xx.c $_
-
linux 查找命令
apropos
等同于man -k
-
linux tcp/ip 命令 netcat
-
htop 类似于 top
-
命令 cut & paste
-
禁止访问 某个ip 的端口。 iptables iptables -A OUTPUT -d 10.94.xx.xx -p tcp –dport 33133 -j REJECt iptables -F 清除所有规则 iptables -L 列出所有规
多个端口 -m –dports 反转匹配 !
-
查看开启的端口 netstats -tulp nmap
-
获取 ipv4 地址
ip addr show eth0 awk ‘/inet / {FS = “/”; $0 = $2; print $1}’ -
删除结尾换行回车符
tr -d ‘\n’