Managing /etc/hosts with Ghost
As web developers, we change our hosts file on a day to day basis while testing pre-launch projects, that aren’t hosted on their domain yet.
Now with cloud computing we’re editing it even more often and I don’t know about you, but I’m getting tired of `sudo nano /etc/hosts`.
Luckily there’s an alternative, Ghost.
Ghost is a ruby gem that manages /etc/hosts, and it has some nice features like import / export and CNAME-like records.
To get started with Ghost, install it like you would with any other gem (sudo gem install ghost) and take a look at the examples listed below. Enjoy!
(examples kindly pasted from http://github.com/bjeanes/ghost)
$ ghost add mydevsite.local [Adding] mydevsite.local -> 127.0.0.1 $ ghost add staging-server.local 67.207.136.164 [Adding] staging-server.local -> 67.207.136.164 $ ghost list Listing 2 host(s): mydevsite.local -> 127.0.0.1 staging-server.local -> 67.207.136.164 $ ghost delete mydevsite.local [Deleting] mydevsite.local $ ghost delete_matching test [Deleting] test2.local [Deleting] test.local $ ghost list Listing 1 host(s): staging-server.local -> 67.207.136.164 $ ghost modify staging-server.local 64.233.167.99 [Modifying] staging-server.local -> 64.233.167.99 $ ghost list Listing 1 host(s): staging-server.local -> 64.233.167.99 $ ghost export > some_file $ ghost empty [Emptying] Done. $ ghost list Listing 0 host(s): $ ghost import some_file [Adding] staging-server.local -> 64.233.167.99 $ ghost list Listing 1 host(s): staging-server.local -> 64.233.167.99 $ ghost add staging-site.local staging-server.local [Adding] staging-site.local -> 64.233.167.99