How-To Geek
How To Figure Out Your PC’s Host Name From the Command Prompt
If you’re doing any work with networking, you probably need to know the name of your computer. Rather than diving into Control Panel, there’s a really simple way to do this from the command prompt.
Note: If you haven’t already, be sure to read our complete guide to networking Windows 7 with XP and Vista.
To see the hostname… all you have to do is type hostname at the command prompt. Go figure, eh?
The same thing works in Linux or OS X, though you can see that most of the time the hostname is part of the prompt anyway. Note: you can also change the hostname by simply typing “hostname <newhostname>”.


Of course, the easiest way to see your computer name in Windows is to just hit the Win+Break key combination, which will pop up the System pane from Control Panel.

If you want to change it instead, you can always change your computer name easily through Control Panel.
Got Feedback? Join the discussion at discuss.howtogeek.com
Comments (9)
Programmer by day, geek by night, The Geek, also known as Lowell Heddings, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on Google+ if you'd like.
- Published 04/29/10




It is not advisable to change your host name using the `hostname` command. The reason being that it doesn’t update your /etc/hosts file, and so certain applications (most notably, Gnome!) will not function appropriately. It’s also worth noting that some distros (like Gentoo) reset the hostname every time you boot up based on values parsed out of a config file (in Gentoo’s case, this file is /etc/conf.d/hostname).
What a simple and elegant solution using the hostname command. I love simple, elegant solutions. However, I tend to use “ipconfig /all” out of habit to get the IP address information, including hostname. The advantage of the “ipconfig /all” solution is it bypasses the local administrator restriction when you can’t even see the network parameters page from Control Panel.
That’s a good point… I should have mentioned that you need to update the config files too.
While hostname works in XP and higher for Windows users, Winkey+Pause/Break will only work I believe with Vista and higher. For XP you’d have to go to the computer name tab as well after the key combination.
ipconfig /all | find “Host”
is also a long way of getting the same information. Stupid trick actually. :)
ciao!
nice commands
I am a 54 yo woman who admits to being computer illiterate. I have a DELL with antenna network which works great ! My neighbor doesn’t care.
Problem is: One time I wanted to send a question to a Company and it asked what my server was. I put “I have no idea” and of course they don’t recognize this server, so now I can’t message any Companies.
I really have no idea what a server host is and how to change it.
Can anyone help? And remember, I don’t know shit…..make it super easy, step by step. And when you tell your friends about this ole lady, and I know you will, just remember, the 60/70′s affected us all.
Whenever I enter any command, any random command, my command prompt/command line says that every single thing is “not recognized as an internal or external command, operable program or batch file.”
What is wrong and what must I do to fix this??
Someone please help me out.!
What I wanted to say was “hostname newhostname” is not working..it stripped out the second word assuming as an html tag