Home / Networking Commands / hostname

hostname

Display Computer Name

What Does It Do?

The hostname command displays your computer's name on the network. This is the friendly name that identifies your machine to other devices and appears in network lists.

Your hostname is how your computer is known on the network - like a name tag for your machine. It's used by network administrators, file sharing, and various network services to identify your computer.

Advertisement

[ Insert Google AdSense Banner Code Here ]

When Should I Use It?

Check Computer Name

Quickly see what your computer is called on the network.

Remote Administration

Identify which computer you're connected to when managing multiple machines.

Scripting & Automation

Use in scripts to identify which machine is running the script.

Network Troubleshooting

Verify your computer's network identity when diagnosing connection issues.

Common Commands

hostname

Display your computer's network name.

hostname -s

Display short hostname (Linux/Mac - without domain).

hostname -f

Display fully qualified domain name (Linux/Mac).

hostname -i

Display IP address associated with hostname (Linux).

Try It Yourself

Practice using the hostname command in the terminal below: