
Hosts Commander is designed to make it as easy as possible to work with the hosts file from the console. If you occasionally have to get into this file (which is typical for a web developer), and you love the console -
Hosts Commander may be your liking.
A year ago, the first version of the program, which worked only under Windows, was announced on Habrahabr. But since then, much has changed and become better. This is a great example of how something more can grow out of a simple idea.
How did it all begin?
- Add, remove, disable, and hide operations
- Display hosts from hosts by mask
- Mask operations on hosts
- Saving the original layout and encoding of the hosts file
- Backup Hosts and Restore
- Support for Windows XP / Vista / 7 (.NET 3.5)
What is new?
Linux support
From the very beginning, it seemed that the Linux console already had very rich capabilities, so the appearance of such a program would not be appreciated by the community. However, I received several letters asking for the opportunity to work under Linux.
The latest version of Hosts Commander has added support for Linux and other Unix-like operating systems. Run with superuser rights only require commands that change the contents of the hosts.
To start, you need to install
Mono 2.8+ , which in some distributions (for example, Ubuntu) is by default.
The launch is performed by a command like
mono hosts.exe param1 param2 param3
, which is not very convenient. But you can easily create
alias hosts="mono hosts.exe"
to work with hosts in the same way as under Windows.
Alias support and smart add command
It is sometimes convenient to store several domains at once in one record (for example, the version with www and without) and operate with them together. Hosts Commander now allows you to do this. Moreover, when adding a new record, the add command itself guesses where the IP address is, and where the domain and its aliases are, so there is no need to remember in which order the parameters should be specified. Everything after the # sign is considered a comment, so there is no need to write it in quotes.
Examples:
hosts add mydomain.ru www.mydomain.ru 192.168.0.1 # my comments
hosts add 192.168.0.1 mydomain.ru www.mydomain.ru
IDN support (Russian domains)
Russian-language domains should be stored in the hosts encoded in Punycode (xn--). Manually generate xn - d1abbgf6aiiy.xn - p1ai from president. RF is not so easy, and even if you are browsing hosts without comment, it is not clear which Russian-language domain is.
Hosts Commander solves this problem. All Russian-language domains are stored in Punycode, but the program works with decoded versions.
Examples:
hosts add . mydomain.ru www.mydomain.ru #
hosts add . mydomain.ru www.mydomain.ru #
- add a host with aliases, the default IP is 127.0.0.1.
hosts view *.
- displays domains in the zone.rf
IPv6 address support
IPv6, unfortunately, is not actively used today. However, modern operating systems support it fully. Hosts Commander boasts the same:
hosts add ipv6demo.local ::1
Due to the fact that two entries with the same domain can be declared in one hosts file, but with IPv4 and IPv6 addresses, the add command now always adds a new host to the end of the file, and the set command is used to update existing entries. This is quite a controversial point. If you have an idea how to make the add and set commands more convenient and transparent - please share in the comments or email.
')
Rollback last operation
Some commands can lead to serious consequences. For example, a randomly executed
hosts rem *
will delete all entries in the hosts file, and you just wanted to type in
hosts rem *.
, but pressed to enter ahead of time.
Now a simple command
hosts rollback
allows you to roll back the last operation on hosts.
Built-in command interpreter
Now when you start the hosts without parameters, the built-in command interpreter is launched. It supports all commands available for direct calling. The main difference is that you do not need to write
hosts
before each command. Conveniently, if you need to perform many operations with the hosts file. Another advantage when running from a console with limited rights under Windows Vista / 7: after agreeing to grant Hosts Commander access to the system, a new window will open that will not be immediately closed.
The exit from the command interpreter is done with the
exit
or
quit
commands.
Total
The project, along with source codes and more detailed documentation, is available on the
hostscmd.googlecode.com page.
The topic is open to feedback and suggestions. If you encounter any problems in the program, please let us know and I will try to solve them.
Thanks for attention.