Dictionary · Linux and Windows Commands
hostname
Identity · Beginner
Prints or, with the right privilege, sets the computer's host name. The printed name is the machine's own name, not a full proof of directory identity.
It is the fastest way to be sure which machine a terminal session is attached to. Use it before you change anything on what you think is a lab box.
Example: hostname prints a short name such as web-01. The name should match the machine you intended to administer.
Command
Platform: Windows, Linux, and macOS
hostname
The single line of output is the host's configured name. Confirm it matches your change ticket before continuing.
Common misconception
- The local name is not automatically the public name clients use. Name records can point somewhere else.