linux命令大全地址 http://man.linuxde.net/
可以通过设置GREP_OPTIONS 为'--color=auto'来自动为匹配部分着色
也可以通过设置GREP_COLOR的值来指定颜色下面是部分颜色的值
30 black
31 red
32 green
33 yellow
34 blue
35 purple
36 cyan
37 white
命令如:export GREP_OPTIONS='--color=auto' GREP_COLOR='31'
$grep -5 'parttern' inputfile //打印匹配行的前后5行
$grep -C 5 'parttern' inputfile //打印匹配行的前后5行
$grep -A 5 'parttern' inputfile //打印匹配行的后5行
$grep -B 5 'parttern' inputfile //打印匹配行的前5行
一、查看哪些端口被打开 netstat -anp 二、关闭端口号:iptables -A INPUT -p tcp --drop 端口号-j DROP iptables -A OUTPUT -p tcp --dport 端口号-j DROP 三、打开端口号:iptables -A INPUT -ptcp --dport 端口号-j ACCEPT 四、以下是linux打开端口命令的使用方法。 nc -lp 23 &(打开23端口,即telnet) netstat -an | grep 23 (查看是否打开23端口) 五、linux打开端口命令每一个打开的端口,都需要有相应的监听程序才可以启动成功后,如果需要再其他服务器访问,则需要开启这些端口。不然其他服务器无法访问。开启端口如下,
去修改/etc/sysconfig/iptables下的配置。vi /etc/sysconfig/iptables.
然后重启iptables服务器。service iptables restart;
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6180 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6181 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6182 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6183 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6184 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 6185 -j ACCEPT