MAC got ya down?

Do you need to edit the hosts file on a MAC and just haven't memorized those pesky commands?

Suppose your host file looks like this, and you want to add one route to a new website or domain.

# Comments in a hosts file are preceeded with a hash '#' mark.
127.0.0.1 localhost loopback
::1 localhost

You want it to look like this.

# Comments in a hosts file are preceeded with a hash '#' mark.
127.0.0.1 localhost loopback
::1 localhost
135.1.2.3 www.SpiffyNewWeb.com

Chances are you are in a user subdirectory and you will need to move up a couple levels believe it or not the old dos command ' cd .. [ crlf ] ' will get you there. Where cd is litterally the character c followed by d. The double dots are literally a space followed by two periods, and I elected to type [ crlf ] as a way of saying , 'Carriage Return & Line Feed' or the Enter key.  Yes that is really how you move from directory to directory when you don't use GUI.

Let's list some commands and what they do first. Remember children, VI, CP/M, UNIX all are not that playful friendly operating system we have come to know and love called Windows.
Every command IS CASE SENSITIVE!

Upon the first opening of a file in VI the editor is by default in the 'Command Mode' meaning it expects you to tell the VI editor program what to do next. The VI editor is not expecting you to just start randomly typing in new text strings. Either one of these takes you from Command mode into an edit mode.

How do you save these changes? A simple escape or quit won't do, and threatening the computer with a loaded .38 doesn't work either, I have tired. You must first use the esc key. This will tell the VI editor that you want to go back to Command Mode from edit mode. THEN you must enter the correct exit command string of characters after the Colon.  Usually a lower case letter 'w' then 'q' to write and quit the VI editor and save your file.

In a nut shell your string of command will probably look like this. * sudo vi hosts [ crlf ] * i * enter new hosts entry * esc * wq [ crlf ]
I hope this helps you. I have tried to write in a humors fashion in the hope that you remember some of these archaic dry commands. The truth is when these commands and VI was thought up back in 1976 it was certainly cutting edge stuff.