hosts command is used to manage the hosts file of the operating system. The hosts file is a file used for domain name resolution to IP addresses and is typically used locally to override DNS resolution. By modifying the hosts file, you can assign a custom IP address to a specific domain name without relying on a DNS server.
sealctl hosts provides the following three subcommands to manage the hosts file:
list: List all entries in the current hosts file.
add: Add a new domain-to-IP mapping to the hosts file.
delete: Delete a specified domain-to-IP mapping from the hosts file.
With these subcommands, you can conveniently view, add, and delete mappings in the hosts file, allowing you better control over domain name resolution to IP addresses.
sealctl hosts list: List all entries in the current hosts file.
sealctl hosts list
sealctl hosts add: Add a new entry to the hosts file.
--ip: IP address (required)
--domain: Domain name (required)
sealctl hosts add --ip 192.168.1.100 --domain example.com
sealctl hosts delete: Delete an entry from the hosts file.
--domain: Domain name to delete (required)
sealctl hosts delete --domain example.com
Note: You can specify the path of the hosts file by adding the
--path parameter after any
hosts subcommand. The default path is
/etc/hosts (Linux systems).
sealctl hosts list --path /custom/path/hosts