hostname

Overview

The hostname command shows or sets the system’s host name. It displays the name by which the system is known on a network.

Syntax

hostname [options] [hostname]

Common Options

Option Description
-a Alias names
-A All FQDNs
-d DNS domain
-f FQDN name
-i IP addresses
-I All addresses
-s Short name
-y NIS domain
--help Show help
--version Show version

Output Types

Type Description
Short Simple hostname
FQDN Full domain name
Domain DNS domain
IP IP addresses
Alias Alternative names

Key Use Cases

  1. System identification
  2. Network configuration
  3. DNS setup
  4. Host verification
  5. Network troubleshooting

Examples with Explanations

Example 1: Show Name

hostname

Display hostname

Example 2: Show FQDN

hostname -f

Full domain name

Example 3: Show IPs

hostname -I

All IP addresses

Common Usage Patterns

  1. Basic check:

    hostname
  2. Network info:

    hostname -i
  3. Domain name:

    hostname -d

Network Information

  1. Host name
  2. Domain name
  3. IP addresses
  4. Alias names
  5. Network identity

Additional Resources

Best Practices

  1. Proper naming
  2. DNS alignment
  3. Network consistency
  4. Documentation
  5. Regular verification

Network Analysis

  1. Name resolution
  2. IP configuration
  3. Domain setup
  4. Network identity
  5. System naming

Troubleshooting

  1. Name resolution
  2. DNS issues
  3. Network problems
  4. Configuration errors
  5. Identity conflicts

Common Uses

  1. System setup
  2. Network config
  3. DNS management
  4. Identity verification
  5. Documentation