Mac OS X, Mac OS X Server, Ubuntu, Unix hostname May 12, 2008 OK, so this one is pretty easy. You can use the hostname command to return back the name of your computer. There’s also a nifty little s flag to remove any domain naming from the return string.