解压:tar -zxvf ams.tar.gz
压缩:tar -zcvf ams.tar.gz /ams-jetty
添加路由:
步骤1:查看本机IP地址
[root@localhost root]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:A7:6E:77
inet addr:10.0.0.120 Bcast:10.0.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2418 errors:0 dropped:0 overruns:0 frame:0
TX packets:1293 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:1000347 (976.9 Kb) TX bytes:192592 (188.0 Kb)
Interrupt:10 Base address:0x2024
步骤2:添加路由规则
[root@localhost root]# route add -net 192.168.2.0/24 eth0
或 [root@localhost root]# route add -net 192.168.0.0/24 gw 192.168.5.50
route add -net 11.1.1.0 netmask 255.255.255.0 gw 11.1.1.1
步骤3:查看路由规则
[root@localhost root]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 * 255.255.255.0 U 0 0 0 eth0
192.168.2.0 * 255.255.255.0 U 0 0 0 eth0
169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
注:route规则中,必须同时存在两个网段,否则,一个网段的IP地址将无法访问到另一网段的IP地址。
步骤4:检测本地机(IP:10.0.0.120)与远程机(IP:192.168.2.80)是否可互访.
[root@localhost root]# ping 192.168.2.80
PING 192.168.2.80 (192.168.2.80) 56(84) bytes of data.
64 bytes from 192.168.2.80: icmp_seq=1 ttl=127 time=5.51 ms
64 bytes from 192.168.2.80: icmp_seq=2 ttl=127 time=3.17 ms
步骤5:删除路由规则
[root@localhost root]# route del -net 192.168.2.0/24 eth0
A类IP地址:用7位(bit)来标识网络号,24位标识主机号,最前面一位为"0",即A类地址的第一段取值介于1~126之间。A类地址通常为大型网络而提供,全世界总共只有126个只可能的A类网络,每个A类网络最多可以连接16777214台主机。
B类IP地址:用14位来标识网络号,16位标识主机号,前面两位是"10".B类地址的第一段取值介于128~191之间,第一段和第二段合在一起表示网络号。B类地址适用于中等规模的网络,全世界大约有16000个B类网络,每个B类网络最多可以连接65534台主机。
C类IP地址:用21位来标识网络号,8位标识主机号,前面三位是"110".C类地址的第一段取值介于192~223之间,第一段、第二段、第三段合在一起表示网络号。最后一段标识网络上的主机号。C类地址适用于校园网等小型网络,每个C类网络最多可以有254台主机。
查看进程:
ps -aux | grep java
访问网络
1.elinks - lynx-like替代角色模式WWW的浏览器
例如:
elinks --dump http://www.baidu.com
2.wget 这个会将访问的首页下载到本地
[root@el5-mq2 ~]# wget http://www.baidu.com
--2011-10-17 16:30:10-- http://www.baidu.com/
Resolving www.baidu.com... 119.75.218.45, 119.75.217.56
Connecting to www.baidu.com|119.75.218.45|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 8403 (8.2K) [text/html]
Saving to: `index.html'
100%[==========================================================================================>] 8,403 --.-K/s in 0.01s
2011-10-17 16:30:10 (648 KB/s) - `index.html' saved [8403/8403]
3.curl会显示出源码
curl http://www.baidu.com/index.html
4.lynx(这个以前在群里面见有人讨论过,但是没有尝试过,想用的话还需要下载软件)
lynx http://www.baidu.com
./ffmpeg -i /tmp/video/ad3.MP4 -fpre vod -bsf h264_mp4toannexb -b:v 300k -b:a 128k -filter:v yadif=deint=interlaced -maxrate 300k -minrate 300k -acodec copy -metadata service_name="coship4K9" -muxrate 320k -s 1280*720 -f mpegts -y /tmp/video/ad3.ts
SSH命令
不指定用户:
ssh 192.168.0.11
指定用户:
ssh -l root 192.168.0.11
ssh root@192.168.0.11
如果修改过ssh登录端口的可以:
ssh -p 12333 192.168.0.11
ssh -l root -p 12333 216.230.230.114
ssh -p 12333 root@216.230.230.114
另外修改配置文件/etc/ssh/sshd_config,可以改ssh登录端口和禁止root登录。改端口可以防止被端口扫描。
编辑配置文件:
vim /etc/ssh/sshd_config
找到#Port 22,去掉注释,修改成一个五位的端口:
Port 12333
找到#PermitRootLogin yes,去掉注释,修改为:
PermitRootLogin no
重启sshd服务:
service sshd restart
根据进程号查看安装路径:
pwdx 进程号
使用chown命令可以修改文件或目录所属的用户:
命令:chown 用户 目录或文件名
例如:chown qq /home/qq (把home目录下的qq目录的拥有者改为qq用户)
使用chgrp命令可以修改文件或目录所属的组:
命令:chgrp 组 目录或文件名
例如:chgrp qq /home/qq (把home目录下的qq目录的所属组改为qq组)