When you deploy a program to Linux in a real-world production environment or when you update a program on Linux, you often have to modify the contents of the. zip package or the configuration file in the. tar.gz package, which can be cumbersome if you drag the package program on the native and Linux and then make the change. The VIM command in Linux makes it easy to modify the contents of the. tar.gz or. zip package.
1. Use the VIM command to modify the Tomcat default port number in Server.xml in apache-tomcat-7.0.82.tar.gz.
1) Back up the apahce-tomcat-7.0.82.tar.gz (MV move to another directory)
2) vim Editor. tar.gz Bag
[Email protected] 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) use/conf/server.xml to search out the Server.xml file, modify the port: Wq exit and then back to the previous level directory again: Q exit.
2.vim Command Summary of some shortcut commands
Exit and save |
: Wq |
Exit and Force Save |
: wq! |
Force quit, do not save |
: q! |
Move the cursor to the last line of the file |
Shinft+g |
Move the cursor to the first line of the file |
Gg |
Moves the cursor from the location to the beginning of the current line |
0 |
Moves the cursor from its position to the end of the current line |
$ |
From the cursor position, look down for a string named session |
/session
|
From the cursor position, look up the string named session |
? Session |
Start from the cursor position and repeat the previous search action down |
N |
Repeat the previous search move up from the cursor position |
N |
Delete the cursor where you are moving forward |
Dd |
Enter edit mode |
I |
Cut back to Normal mode |
Esc |
The contents of the. tar.gz package and. zip package commands are modified with the VIM command in Linux.