Command: hosts

Manage entries in the /etc/hosts file.

Usage

Usage: m hosts [OPTION] [ARGUMENTS]

Description: Manage the /etc/hosts file on your system

Options:
  --help            Show this help message
  --ls              List current records in the /etc/hosts file
  --add IP HOST     Add a new host to the /etc/hosts file
  --remove HOST     Remove a host from the /etc/hosts file

Note: Modifying the hosts file requires sudo privileges.

Options

--ls

Lists all active (non-commented) entries in your /etc/hosts file.

Example:

m hosts --ls

--add IP HOST

Adds a new entry to the /etc/hosts file, mapping an IP address to a hostname. It also automatically flushes the DNS cache.

Example:

sudo m hosts --add 127.0.0.1 local.project.dev

--remove HOST

Removes all entries from /etc/hosts that match the specified hostname. It also automatically flushes the DNS cache.

Example:

sudo m hosts --remove local.project.dev