Exactly as I wrote it, or your example is probably fine as well. Just make sure there is a space or 2 between the IP address and the name. If it is a Windows box, be very careful of Notepad, Wordpad etc as they love adding a 'hidden' .txt extension, which will break everything. A DOS commandline edit is safest.
On a Windows system, the hosts file is hidden off the main Windows folder on C: