How to Edit HTML Files in Terminal

If you have a Unix, Linux or Mac OS X operating system on your computer, you have access to a command-based terminal. The terminal is useful for basic operation as well as for executing commands that graphical user interfaces might complicate. If you are developing a hypertext markup language, or HTML, Web page you only need a basic level of text input as HTML is a plain-text file type. Therefore you can use the "vi" editor in the terminal to code your page.

Step

Open the Terminal application. This will differ depending on your operating system, consult the documentation if you are unsure.

Step

Type "vi filename.html". If no file called "filename.html" exists, it will create the page. Enter an existing HTML file name if you want to edit a page that already exists.

Step

Press "Enter." This will open the vi text editor with the HTML page already loaded.

Step

Type ":help" and press "Enter." To open the help file. This will detail how to use the vi editor and navigate through the application. There are two modes in vi, input mode and command mode. If you are in input mode, you will not be able to move around with the arrow keys.

Step

Press "i" to enter input mode at the beginning of the cursor. Edit your HTML document as you wish.

Step

Press "ESC" to exit input mode. Hold "SHIFT" and press "Z" twice to save and exit from VI.