Home > Linux / Unix, Tutorial, Ubuntu > How to change the hostname in Ubuntu

How to change the hostname in Ubuntu

To change hostname in Ubuntu or any Debian variant Linux, modify the /etc/hostname and /etc/hosts.

sudo vi /etc/hostname

Change the old hostname to a new hostname.

sudo vi /etc/hosts

Also, change the oldhostname to a new hostname,               newhostname

After done, changing the /etc/hostname and /etc/hosts, you need to restart the hostname service.

sudo /etc/init.d/hostname.sh stop

sudo /etc/init.d/hostname.sh start

And then you log out from the shell and log in back. Once logged in, type


to check on the changes you have made for the hostname.

Categories: Linux / Unix, Tutorial, Ubuntu Tags:
  1. May 21, 2009 at 7:10 am

    In the /etc/hostname file should I also specify the domain name ? which method is recommended

    which is the better way (in /etc/hostname)
    – or –

    Similarly in /etc/hosts which is a better entry an fqdn type full name or just the short name (of course they can be specified as aliases).

  2. May 21, 2009 at 11:22 pm

    Нет,по настоящиму улыбнул 8 пункт,просто представил такую ситуацию ))).

  3. May 23, 2009 at 7:22 am

    Нет,по настоящиму улыбнул 8 пункт,просто представил такую ситуацию ))).

  4. May 24, 2009 at 2:47 am

    И опять об этом. Если поисковики научатся понимать смысл, то блогерам придется поизголяться, чтобы быть читаемыми и не похожими на других.

  5. May 25, 2009 at 12:56 am

    на края луны, без вины, без вина, она одна о_0 пробило еп*

  6. May 26, 2009 at 2:19 pm

    Очень познавательно. Спасибо.

  7. August 2, 2009 at 10:59 pm

    thank you, this tut helped to change hostname on ubuntu

  8. January 2, 2010 at 10:17 pm
  9. chockascisa
    January 11, 2010 at 8:37 pm

    зайдите – http://biznesleto.ru/category/rukovodstvo-biznesom/page/3 Бизнес-лето » Руководство бизнесом. Блог. Заметки о бизнесе.

  10. January 11, 2010 at 9:25 pm

    заходите пожалуйста на сайт – http://chastniybiz.ru/theme/licenzirovanie/ лицензирование Частный бизнес.

  11. January 11, 2010 at 10:17 pm

    заходите пожалуйста на стартап – Алла Тарасова Синема 4 топ

  12. January 12, 2010 at 12:23 am

    http://oslikauto.ru/category/avto-novinki/page/6/ Ослик авто Страница 6.

  13. January 12, 2010 at 12:48 am

    http://publife.ru/07/ferrari-na-vode/ Блоги на Publife — Blog — Ferrari на воде..

  14. January 12, 2010 at 1:15 am

    http://sdelaybanu.ru/category/steny/ Стены Сделай баню. Всё о банях..

  15. January 12, 2010 at 2:11 am
  16. January 14, 2010 at 6:27 am

    С большим удовольствием читаю ваш блог. Продолжайте писать обязательно. Андреич, Хакасия.

  17. March 19, 2010 at 11:58 am

    Хорошая статья. Действительно было интересно почитать. Не часто такое и встречается та.Наверное стоит подписаться на ваше RSS

  18. December 13, 2010 at 4:34 am

    some genuinely wondrous work on behalf of the owner of this website , absolutely great subject matter.

  19. June 2, 2011 at 10:31 am

    Всем хорошего времени суток! Кто знает где находится село дебесы?.

  20. November 20, 2011 at 12:51 am

    Great website. A lot of useful information here. I am sending it to a few buddies ans also sharing in delicious. And of course, thanks for your sweat!

  21. vikosha0458727
    December 21, 2011 at 7:53 pm

    , IBD.
    , . .
    5000 , IBD- , .

    Email: 0458727@gmail.com
    , .

    .ibd. Bonder Gel, 14 . 732,375
    .ibd. Clear Gel, 14 . 732,375
    .ibd. Clear Gel, 56 . 1559,25
    .ibd. Clear Gel, 226 . 3945,375
    .ibd. Builder Gel Clear, 14 . 732,375
    .ibd. Builder Gel Clear, 56 . 1795,5
    .ibd. Builder Gel Pink, 14 . 732,375
    .ibd. Builder Gel Pink, 56 . 1795,5
    .ibd. Builder Gel Ultra White, 14 . 732,375
    .ibd. Builder Gel Ultra White, 56 . 1795,5
    .ibd. Builder Gel White, 14 . 732,375
    .ibd. Builder Gel Natural, 14 . 732,375
    .ibd. French X-treme Builder Gel Clear, 14 . 732,375
    .ibd. French X-treme Builder Gel Blush, 14 . 732,375
    .ibd. French X-treme Builder Gel Blush, 56 . 1795,5
    .ibd. French X-treme Builder Gel Pink, 14 . 732,375
    .ibd. French X-treme Builder Gel White, 14 . 732,375
    .ibd. French X-treme Builder Gel White, 56 . 1795,5
    .ibd. Ultra Seal Clear, 14 . 784,35
    .ibd. Ultra Seal Clear, 113 . 2263,275
    .ibd. Intense Seal, 14 . 732,375
    .ibd. Intense Seal, 236 . 3260,25
    .ibd. Builder Gel Clear 95 . 2740,5
    .ibd. Clear Gel, 30 . 1323
    .ibd. Builder Gel Clear, 30 . 1323
    .ibd. Builder Gel Pink, 30 . 1323
    .ibd. Builder Gel Pink, 95 . 2740,5

    .ibd. Introductory Gel Kit 1559,25
    .ibd. Professional Gel Kit 4862,025
    .ibd. Sweet Confection Gel Polish Kit 2268
    .ibd. Precious Metals Gel Polish Kit 2268
    .ibd. Holiday Gel Polish Collection 1677,375

    .ibd. Gel Polish Up All Night, 7 . 420,525
    .ibd. Gel Polish Extreme Black, 7 . 420,525
    .ibd. Gel Polish Autograph, 7 . 420,525
    .ibd. Gel Polish Tangerine Dream, 7 . 420,525
    .ibd. Gel Polish Glitter Shimmer, 7 . 420,525
    .ibd. Gel Polish Pamper Me, 7 . 420,525
    .ibd. Gel Polish Copper, 7 . 420,525
    .ibd. Gel Polish Rose Gold, 7 . 420,525
    .ibd. Gel Polish Holly Berry, 7 . 420,525
    .ibd. Gel Polish Stainless Steel, 7 . 420,525
    .ibd. Gel Polish Sun Ray, 7 . 420,525
    .ibd. Gel Polish Ruzh f Nuar, 14 . 236,25
    .ibd. Gel Polish Silver Bells, 7 . 420,525
    .ibd. Gel Polish Party Till Dawn, 7 . 420,525
    .ibd. Gel Polish Techno Ruby, 7 . 420,525
    .ibd. Gel Polish Cognac, 14 . 236,25
    .ibd. Gel Polish All Terrain, 14 . 236,25
    .ibd. Gel Polish Titanium, 7 . 420,525
    .ibd. Gel Polish Gracial Mint, 7 . 420,525
    .ibd. Gel Polish Apricot Creme, 7 . 420,525
    .ibd. Gel Polish Eternal Daydream, 14 . 236,25
    .ibd. Gel Polish Tango, 14 . 236,25
    .ibd. Gel Polish Chocolate Gloss, 14 . 236,25
    .ibd. Gel Polish Rustic, 14 . 236,25
    .ibd. Gel Polish Fairytale Romance, 14 . 236,25
    .ibd. Gel Polish Glass Slipper, 14 . 236,25
    .ibd. Gel Polish Spicy Terracotta, 14 . 236,25
    .ibd. Gel Polish Natural Elegance , 14 . 236,25

  22. December 25, 2011 at 6:06 pm

    A person essentially help to make severely articles I’d state. This is the very first time I frequented your website page and to this point? I surprised with the research you made to make this actual post extraordinary. Great job!

  23. February 27, 2013 at 1:59 pm

    Thanks for ones marvelous posting! I seriously enjoyed reading it,
    you happen to be a great author.I will ensure that I bookmark
    your blog and will eventually come back later in life.
    I want to encourage you to continue your great job, have a nice evening!

  24. April 20, 2013 at 3:21 pm

    wonderful publish, very informative. I ponder why the opposite experts of this
    sector do not notice this. You must continue your writing.
    I’m confident, you have a great readers’ base already!

  25. May 7, 2013 at 1:58 pm

    Cool blog! Is your theme custom made or did you download it from somewhere?
    A design like yours with a few simple adjustements would really make my blog
    stand out. Please let me know where you got your
    design. Cheers

  26. May 23, 2013 at 10:12 am

    hello there and thank you for your information – I have definitely picked up something new from right
    here. I did however expertise a few technical points using
    this website, since I experienced to reload the website a lot of times previous to I could get it to load correctly.

    I had been wondering if your hosting is OK? Not that I’m complaining, but sluggish loading instances times will very frequently affect your placement in google and can damage your high quality score if ads and marketing with Adwords. Well I’m adding this RSS to my email and
    can look out for much more of your respective intriguing content.
    Make sure you update this again soon.

  27. June 12, 2013 at 8:50 pm

    Use of the drug because oxycodone also contains acetaminophen why Viagra’s active ingredient is known as a PDE5 inhibitor. Into the bloodstream, providing can use your Delivery tracking code purchase by clicking “Buy now” button. Oxycodone is an extended-relief medication, it slowly powerful painkiller develop a tolerance. Because you spend less treatment for male patients suffering for rehab centers for a loved one, you should ensure that the person has an oxycodone problem. That provides the type of support that you need can worsen in those relief from pain and pleasurable feelings that occur because of the medication can cause addiction in some patients. For.
    Cialis mexico

  28. August 8, 2013 at 2:19 am

    It’s not my first time to pay a quick visit this website, i am visiting this web page dailly and take pleasant data from here all the time.

  29. October 14, 2013 at 3:28 am

    Sweet blog! I found it while searching on Yahoo News. Do you
    have any tips on how to get listed in Yahoo News? I’ve been trying for a while but I never seem to get there!

    Thank you

  30. March 22, 2014 at 5:08 am

    I am really impressed with your writing skills and also with the layout on your weblog.
    Is this a paid theme or did you customize it yourself?

    Either way keep up tthe excellent quality writing, it’s rare to see
    a nice blog like this oone these days.

  31. June 16, 2014 at 3:41 pm

    Your employees will probably be very unhappy to received payment
    delayed. The following points demonstrate the good and
    bad qualities of Schedule C, something every self-employed individual must be aware of.
    Merchants have options in the event it concerns accepting credit cards
    online, but essentially the most popular option is to utilize a third party vendor mainly because it’s generally most affordable and less work
    for businesses.

  32. March 23, 2016 at 8:13 am

    Деревянные лестницы.Из массива ценных пород!(дуб,бук,ясень)!
    По выгодным ценам!Изготовление лестниц в Екатеринбурге!http://lestnica-na.ru/index.php/izgotovlenie-lestnits

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: