System Info
hostname
Show or set the system's network hostname.
Synopsis
syntax
hostname [OPTION]... [NAME]
Examples
Show current hostname
hostname
Show fully qualified domain name
hostname -f
Show all IP addresses
hostname -I
Set hostname (temporary until reboot)
sudo hostname newname
Common options
| Flag | Description |
|---|---|
| -f | Display FQDN (fully qualified domain name) |
| -i | Display IP addresses |
| -I | Display all network addresses |
| -s | Display short hostname |
About hostname
The `hostname` command show or set the system's network hostname. System information commands provide insight into hardware, kernel, memory, disk, and user session details.
These are typically the first tools you reach for when diagnosing system problems, capacity planning, or auditing a server's configuration. They work across most Linux distributions without additional packages.
The command accepts 4 commonly used flags shown above, though the full set of options is available in the man page (`man hostname`). The 4 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.
Related commands
More System Info Commands
Other commands in the System Info category