endutent - Linux


endutent is a command-line tool used to mark the end of an entry in the host configuration database "/etc/hosts". It primarily serves as an auxiliary command in conjunction with "setent" and "hostent" to efficiently manage entries in the database.


endutent [database_file]


  • database_file: (Optional) Specifies the path to the host configuration database file to modify. Defaults to "/etc/hosts" if not provided.


Example 1: Add an Entry

To add an entry to the "/etc/hosts" file with an IP address, hostname, and aliases:

setent hosts
endutent hosts

Example 2: Modify an Existing Entry

To modify an existing entry in "/etc/hosts" by changing the IP address:

setent hosts
editent hosts HOSTNAME
endutent hosts

Example 3: Delete an Entry

To delete an entry from "/etc/hosts" with a specific hostname:

setent hosts
delete hosts HOSTNAME
endutent hosts

Common Issues

  • Incorrect database file specified: Ensure that the provided database file path exists and is accessible for modification.
  • Empty database file: Before using endutent, make sure the database file is not empty and contains at least one entry.


endutent is commonly used in conjunction with other commands for advanced host configuration tasks:

  • setent: Initializes the database for editing.
  • hostent: Traverses the database and reads host information.
  • addent: Adds a new entry to the database.
  • editent: Modifies an existing entry in the database.
  • delete: Removes an entry from the database.

Related Commands

  • hostname: Displays or sets the hostname of the current system.
  • ip: Displays or manipulates IP addresses and network interfaces.
  • nslookup: Queries DNS servers to obtain host information.