1.用vim命令修改 apache-tomcat-7.0.82.tar.gz中server.xml中的tomcat默认端口号。
1)将apahce-tomcat-7.0.82.tar.gz进行备份(mv移动到其它目录)
2) vim编辑.tar.gz包
[root@192 tomcat7]# vim apache-tomcat-7.0.82.tar.gz
apache-tomcat-7.0.82/webapps/host-manager/images/docs.gif
apache-tomcat-7.0.82/webapps/host-manager/images/fix.gif
apache-tomcat-7.0.82/webapps/host-manager/images/tomcat.gif
apache-tomcat-7.0.82/webapps/host-manager/images/update.gif
apache-tomcat-7.0.82/webapps/host-manager/images/void.gif
apache-tomcat-7.0.82/webapps/host-manager/index.jsp
apache-tomcat-7.0.82/webapps/host-manager/manager.xml
apache-tomcat-7.0.82/webapps/manager/META-INF/context.xml
apache-tomcat-7.0.82/webapps/manager/WEB-INF/jsp/401.jsp
apache-tomcat-7.0.82/webapps/manager/WEB-INF/jsp/403.jsp
apache-tomcat-7.0.82/webapps/manager/WEB-INF/jsp/404.jsp
apache-tomcat-7.0.82/webapps/manager/WEB-INF/jsp/sessionDetail.jsp
apache-tomcat-7.0.82/webapps/manager/WEB-INF/jsp/sessionsList.jsp
apache-tomcat-7.0.82/webapps/manager/WEB-INF/web.xml
apache-tomcat-7.0.82/webapps/manager/images/add.gif
apache-tomcat-7.0.82/webapps/manager/images/asf-logo.svg
apache-tomcat-7.0.82/webapps/manager/images/code.gif
apache-tomcat-7.0.82/webapps/manager/images/design.gif
apache-tomcat-7.0.82/webapps/manager/images/docs.gif
apache-tomcat-7.0.82/webapps/manager/images/fix.gif
apache-tomcat-7.0.82/webapps/manager/images/tomcat.gif
apache-tomcat-7.0.82/webapps/manager/images/update.gif
apache-tomcat-7.0.82/webapps/manager/images/void.gif
apache-tomcat-7.0.82/webapps/manager/index.jsp
apache-tomcat-7.0.82/webapps/manager/status.xsd
apache-tomcat-7.0.82/webapps/manager/xform.xsl
3)用/conf/server.xml搜索出server.xml文件,修改端口:wq退出然后退到上一层目录再:q退出。

2.vim命令一些快捷方式命令总结
| 退出并保存 | :wq |
| 退出并强制保存 | :wq! |
| 强制退出,不保存 | :q! |
| 将光标移动到文件的最后一行 | shinft+g |
| 将光标移动到文件的第一行 | gg |
| 将光标从所在位置移动到当前行的开头 | 0 |
| 将光标从所在位置移动到当前行的结尾 | $ |
| 从光标位置开始,向下寻找名为session的字符串 | /session |
| 从光标位置开始,向上寻找名为session的字符串 | ?session |
| 从光标位置开始, 向下重复前一个搜索的动作 | n |
| 从光标位置开始,向上重复前一个搜索的动作 | N |
| 删除光标所在的当前行 | dd |
| 进入编辑模式 | i |
| 切回到普通模式 | esc |
linux中用vim命令修改.tar.gz包和.zip包命令的内容
原文:http://blog.51cto.com/11218855/2071955