Skip to content

Latest commit

 

History

History
50 lines (33 loc) · 1.06 KB

README.md

File metadata and controls

50 lines (33 loc) · 1.06 KB

qh - quick host

A simple tool to quickly add and remove hosts from your /etc/hosts file.

Usage

Since /etc/hosts is a protected file, you need to run qh with sudo.

While /etc/hosts syntax is ip hostname, qh uses hostname ip to make it easier to remember, since the hostname is the one you'll be using most of the time. Additionally, while /etc/hosts requires a single A IP, qh allows you to use a hostname as well. If a hostname is provided, it will be resolved to an IP address before being added to the /etc/hosts file.

Add a host

$ sudo qh add [domain] [ip or hostname]

Example

$ sudo qh add mysite.dev 192.168.1.2
$ sudo qh add mysite2.dev example.com

Remove a host

$ sudo qh rm [domain]

Example

$ sudo qh rm mysite.dev

Create a temporary host

$ sudo qh tmp [domain] [ip or hostname]

Example

$ sudo qh tmp mysite.dev example.com
...
^C

This will add the host to your /etc/hosts file, but will remove it when you exit the process (Ctrl+C).