← All commands
Topic hub Networking
Windows Linux Networking Expanded guide

Windows hostname equivalent in Linux

Displays the current host name and, with administrator privileges, changes the persistent system host name.

Windows hostname
→
Linux equivalents
Debian/Ubuntu same command
hostnamectl
Fedora same command
hostnamectl
Arch same command
hostnamectl

Overview

What this command does

On Windows, "hostname" is used to show or change the computer name. On Linux, the closest practical mapping shown here is "hostnamectl". Displays the current host name and, with administrator privileges, changes the persistent system host name. This reference is grouped under Networking.

Migration tip: <code>hostname</code> prints the short name. <code>hostnamectl</code> also shows operating-system and kernel details on systemd systems.

Windows → Linux context

What changes when you use this on Linux?

Equivalent task, different tool

Windows hostname maps to hostnamectl for this task. Treat this as a workflow mapping rather than a character-for-character syntax translation.

Portable across the compared distros

The Debian/Ubuntu, Fedora and Arch rows use the same command in this mapping. Package availability or defaults can still vary, so check the installed tool version when an option behaves differently.

Command-specific caution

Changing the hostname may also require updating /etc/hosts for local name resolution.

Practical tasks

Common use cases

Show or change the computer name

Displays the current host name and, with administrator privileges, changes the persistent system host name.

hostname

Print the current hostname

hostnamectl

Show hostname and system details

sudo hostnamectl set-hostname workstation

Set a persistent hostname

Ready to run

Copyable Linux commands

Review paths, device names, package names and permissions before running any command.

hostname
hostnamectl
sudo hostnamectl set-hostname workstation

Walkthrough

Examples with explanations

hostname # print the current host name
hostnamectl # show detailed host information
sudo hostnamectl set-hostname workstation # change the persistent host name

Reference

Common options and variations

Command or optionUse
hostnamePrint the current hostname
hostnamectlShow hostname and system details
sudo hostnamectl set-hostname workstationSet a persistent hostname

Distro differences

Debian/Ubuntu vs Fedora vs Arch

Debian/Ubuntu, Fedora and Arch all use "hostnamectl" for this mapping. The command syntax shown here is portable across the three rows, although installed versions and system defaults can still vary.

DistributionPackage manager / baseEquivalent commandDifference to notice
Debian/Ubuntu same command hostnamectl Same command on this distribution.
Fedora same command hostnamectl Same command on this distribution.
Arch same command hostnamectl Same command on this distribution.

Important

What to watch out for

Changing the hostname may also require updating /etc/hosts for local name resolution.

Keep learning

Related Networking commands