36 votes

How to get the hostname from /etc/hostname & DNS domain name?

When you type hostname it will show you the value that is stored in /etc/hostname See hostname --help for a lot of options. From the help ... -s, --short short host name -a, --alias ...
Rinzwind's user avatar
  • 299k
29 votes
Accepted

Can i configure ubuntu to append a domain to the end of an ssh hostname request?

Probably you already solved this, but maybe later it could help someone: you don't need to mess with your resolv.conf, just can use something like this in your ~/.ssh/config: Host vded-*-001 test-*-...
Mauricio's user avatar
  • 306
28 votes
Accepted

How do I change the hostname on an Ubuntu Core system?

Since Ubuntu 13.10 you should use hostnamectl: sudo hostnamectl set-hostname 'new-hostname' The advantages are numerous including one command to make all those changes reducing problems with typos ...
Panther's user avatar
  • 102k
22 votes
Accepted

What are the default settings for '/etc/hosts' and '/etc/hostname'?

They are based on what you specified as the hostname when you installed: in my below examples "myhostname" is the name you chose. The defaults look a bit like this: /etc/hostname myhostname ...
thomasrutter's user avatar
  • 36.7k
20 votes

How do I change the hostname without a restart?

Cloud-init (Ubuntu 18+) hostname persistence Whilst the above approaches (hostnamectl, etc/hostname, etc) work for immediate hostname change, with the advent of cloud-init - which can control setting ...
Pierz's user avatar
  • 3,063
18 votes

How to change the display name on the Terminal?

This actually displays your username@computername: along with the current directory and a $ sign, which usually means a non-root user, whereas a # sign would mean that you have root permissions. Now, ...
Brane's user avatar
  • 416
18 votes

Should one use FQDN in /etc/hostname instead of hostname?

Revised Answer: The host itself does not handle the actual FQDN. That is handled by the DNS. FQDN (Fully Qualified Domain Name) is handled by DNS translating names into IP addresses. Using the /etc/...
Terrance's user avatar
  • 41.5k
16 votes

configured directory for incoming file does not exist

You can get the path with gsettings get org.blueman.transfer shared-path and change it with (for instance): gsettings set org.blueman.transfer shared-path '/home/toto'
Rémi's user avatar
  • 161
15 votes
Accepted

I want to change the host name - is it enough to edit the /etc/hosts file?

To change the host name persistently, you will have to change it in two files. In the Ubuntu guest system open a terminal and execute these commands : sudo nano /etc/hostname ... now edit the file ...
cl-netbox's user avatar
  • 31.1k
14 votes

How to find a computer name in a LAN from the IP address?

A Netbios name reverse lookup might accomplish what you want more than than "hostname" which is a function of DNS and tcp/ip. nmblookup with the -A parameter returns device names as well as mac ...
Frere's user avatar
  • 168
11 votes

How to get the hostname from a DHCP server

Oli's answer is demonstrably false ("You don't get your hostname from the DHCP server"), as evidenced by the other answers here, and also by my recent experience on a RHEL7 system. Said system got ...
user500492's user avatar
10 votes

Can i configure ubuntu to append a domain to the end of an ssh hostname request?

This is the easiest solution. It works for all hosts, does not require root or access to any DNS/resolver systems. Add to the top of your ~/.ssh/config file (or create if it doesn't already exist): ...
OrangeDog's user avatar
  • 861
10 votes
Accepted

How do I reset my Network settings to default (Ubuntu 16)?

Run ifconfig and see the name of your network adapter. Mine is: enp0s3 now run this command sudo nano /etc/network/interfaces and you should get something inside....delete everything and paste ...
lewis4u's user avatar
  • 4,856
10 votes
Accepted

How should I add a host name to /etc/hosts?

Yes, really. The /etc/hosts file is just a map that links IPs to hostnames. If you want to be able to do things like ssh myname and have that run ssh localhost, you need to add a line that identifies ...
terdon's user avatar
  • 101k
10 votes
Accepted

ssh known_hosts file not using hostnames anymore

As others have commented, HashKnownHosts yes is causing the hostname to not autocomplete due to it being hashed. Add that to a "global" section by using Host * to match all hosts. Host * ...
Nice Guy IT's user avatar
8 votes
Accepted

Why can't I use the same host name for two dual-boot OS on the same machine?

You can have the same host name in each OS in a multi-boot system. However, if you are connecting to the network, your DHCP server may still have an active lease for that name, and Ubuntu tries to ...
dobey's user avatar
  • 41k
8 votes
Accepted

Why one's 127.0.0.0/8 addresses are available?

From the Wikipedia article on loopback: IPv4 network standards reserve the entire 127.0.0.0/8 address block for loopback purposes. That means any packet sent to one of those 16,777,214 ...
muru's user avatar
  • 198k
8 votes
Accepted

Should one use FQDN in /etc/hostname instead of hostname?

In the /etc/hostname file you use only the hostname. The FQDN you can set on: /etc/hosts that might look like: 127.0.1.1 thishost.mydomain.org thishost According to manual of the hosts ...
Adonist's user avatar
  • 350
8 votes

Should one use FQDN in /etc/hostname instead of hostname?

The manpage of hostname(1) discusses this (the paragraph in bold is emphasised by me): THE FQDN The FQDN (Fully Qualified Domain Name) of the system is the name that the resolver(3) returns ...
muru's user avatar
  • 198k
8 votes
Accepted

Make a .sh that sets new username, hostname and password

Why not just use an OEM installation for this? It's not as pretty, but it gets the job done. If you want to go down this route, see izx's excellent answer to this question: How do I pre-install Ubuntu ...
Kaz Wolfe's user avatar
  • 34.1k
7 votes

Launching programs after hostname change returns error _IceTransSocketUNIXConnect: could not connect to local-host

It appears this error stems from the ~/.ICEauthority file. You can use the command iceauth list list your entries. In my case the old hostname included localhost, replace this with your old hostname. ...
Elijah Lynn's user avatar
  • 3,828
7 votes

How to get the hostname from a DHCP server

Note that when using Ubuntu 18.04 the tie-in scripts are no longer necessary. If the hostname of the install is set to localhost in /etc/hostname the DHCP client will set the hostname automatically ...
Justin Scott's user avatar
7 votes
Accepted

How do I change hostname?

Open Terminal (Alt+Ctrl+T), and enter this: sudo -H gedit /etc/hostname Enter your password, and then a file will open. Just change the name to the new hostname, and save the file. Do the same with ...
Kartik Shah's user avatar
6 votes

How do I change the hostname without a restart?

The classical answer to the original poster's question is that, once you've edited /etc/hostname, you make it apply without restart by running hostname(1) with the -F (--file) option as root: sudo ...
Josip Rodin's user avatar
6 votes
Accepted

Unable to update hostname on ubuntu 14.04

The system hostname goes in /etc/hostname. /etc/hosts is for performing local name to IP address mapping. It may contain your local hostname as a convenience, but it is not the location to set your ...
user4556274's user avatar
  • 4,867
6 votes

configured directory for incoming file does not exist

Selecting a new /Downloads/ folder in Blueman fixed the issue for me. You can do it by opening Blueman Services (open Terminal and type blueman-services). There, under 'Transfer Settings', select a ...
tts's user avatar
  • 61
6 votes
Accepted

Ip address changes whenever I modified my location

hostname -I lists all assigned IP addresses on your host presently. I have VMPlayer installed on my system, so I get three IP addresses listed. terrance@terrance-ubuntu:~$ hostname -I 10.0.0.100 172....
Terrance's user avatar
  • 41.5k
6 votes

I want to change the host name - is it enough to edit the /etc/hosts file?

Short Answer: Yes you can. Full Answer: If you do so, you'll have to restart the system to take the changes into effect. Once restarted, the hostname would be changed to "ab" and this change ...
7_R3X's user avatar
  • 1,151
6 votes
Accepted

How to get Ubuntu Host to Register Hostname With DNS Server

Thank you to @Vidarlo. I went back to my dhclient.conf file (/etc/dhcp/dhclient.conf), where I had tried submitting the fqdn already, but I admittedly cut and pasted code I saw from other discussion ...
SW_user2953243's user avatar
5 votes

How do I change the hostname without a restart?

Ubuntu 16.04 Solution based on answer from the DigitalOcean Comunity. Edit hosts file. $ sudo nano /etc/hosts Replace oldname with new one. 127.0.0.1 localhost newname Setup new hostname. $ ...
Jekis's user avatar
  • 258

Only top scored, non community-wiki answers of a minimum length are eligible