You can use just about any domain and IP address you want. You can edit HOSTS file on your Windows & Mac computer using this simple trick. Save the file and you’re ready to SSH into those machines with commands like: ssh nextcloud ssh. You can have a domain name point to something completely different than what it’s supposed to point to.įor example, if you’re trying to cut down on your social media usage, you can have domains like redirect your browser to sites like, say, Wikipedia. Host db1 HostName 192.168.1.100 IdentityFile /.ssh/dbrsa.pub. But it’s important to note that TextEdit can’t open the file directly and you will need to copy the file to an unprotected location, like the Desktop, edit it, and then copy it to TextEdit. With the Mac hosts file being a text document, using TextEdit will be a good enough tool as a Mac hosts file editor.
One method is to use the default TextEdit feature for Mac host file editing. One of the things you can do with the hosts file is to set up redirects. There are a couple of different ways to edit the hosts file in Mac OS X. You can modify these in any way you want to achieve desired results. Easy for novices, but nano, vim, emacs, etc are better.
You can save and edit the file as usual from TextEdit this way in OS X. Type your admin password, hit return, then TextEdit launches as root with the hosts file on the Mac. In a nutshell, the hosts file is nothing but a combination of IP addresses and domain names. Correct, you can edit Hosts file in OS X with TextEdit by entering: sudo open -a TextEdit /etc/hosts. When you enter localhost in your browser, your browser looks into the hosts file, obtains the specified IP address, and takes you to that IP address.
The above two parts, when combined together, redirect all the localhost queries to the IP address 127.0.0.1. Enter your Ecenica web site’s IP and domain name.
Now type terminal.) Copy and paste the following code into Terminal sudo nano /etc/hosts Press Enter. Using the arrow keys navigate to the bottom of the hosts file text and add your new host name mappings under the default ones. The second section where it has the host name is what you use to access that IP address. Open Terminal (Click Spotlight, or press Command+Space. Step 3 Edit The Hosts File The hosts file usually contains some comments (which you can identify by the lines starting with the symbol), as well as some default domain/hostname mappings (e.g. The first section with numbers is the local IP address for your Mac.