Skip to main content

Questions tagged [hostname]

A hostname is the label given to a device connected to a computer network.

Filter by
Sorted by
Tagged with
56 votes
6 answers
390k views

How to correctly set hostname and domain name?

I am renting a server, running Ubuntu 16.04 at a company, let's name it company.org. Currently, my server is configured like this: hostname: server737263 domain name: company.org Here's my FQDN: ...
titsou's user avatar
  • 563
54 votes
7 answers
363k views

How to change hostname on CentOS 6.5?

I can't seem to change the hostname on my CentOS 6.5 host. I am following instructions I found on this (now defunct) page. I set my /etc/hosts like so ... [root@mig-dev-006 ~]# cat /etc/hosts ...
Red Cricket's user avatar
  • 2,213
47 votes
5 answers
145k views

How to get the computer name (not its hostname)?

All the results of my searches end up having something to do with hostname or uname -n. I looked up the manual for both, looking for sneaky options, but no luck. I am trying to find an equivalent of ...
Jonathan H's user avatar
  • 2,393
41 votes
4 answers
105k views

Creating alias to domain name with /etc/hosts

I have a domain setup to point to my LAN's external IP using dynamic DNS, because my external IP address changes frequently. However, I want to create an alias to this host, so I can access it with ...
Oliver Joseph Ash's user avatar
36 votes
2 answers
3k views

How is it that missing 0s are automatically added in IP addresses? (`ping 10.5` equivalent to `ping 10.0.0.5`)

I accidentally typed ssh 10.0.05 instead of ssh 10.0.0.5 and was very surprised that it worked. I also tried 10.005 and 10.5 and those also expanded automatically to 10.0.0.5. I also tried 192.168....
Nicu Stiurca's user avatar
35 votes
2 answers
70k views

How to permanently change hostname in Fedora 21

I've heard that changing the hostname in new versions of fedora is done with the hostnamectl command. In addition, I recently (and successfully) changed my hostname on Arch Linux with this method. ...
PythonNut's user avatar
  • 1,424
34 votes
2 answers
25k views

What's the point of the hostnamectl command?

As opposed to editing /etc/hostname, or wherever is relevant? There must be a good reason (I hope) - in general I much prefer the "old" way, where everything was a text file. I'm not trying to be ...
Graham Nicholls's user avatar
33 votes
3 answers
43k views

How to decrypt hostnames of a crypted .ssh/known_hosts with a list of the hostnames?

I try to find a script to decrypt (unhash) the ssh hostnames in the known_hosts file by passing a list of the hostnamses. So, to do exactly the reverse of: ssh-keygen -H -f known_hosts Or also, to ...
Xorax's user avatar
  • 585
30 votes
4 answers
109k views

How to show the host name in Linux commandline prompt

I have several VMs and right now my command-line prompt looks like -bash-3.2$; identical on every VM, because it doesn't contain the host name. I need to always see which VM I'm on using hostname ...
uday's user avatar
  • 401
30 votes
4 answers
113k views

How to set the fully qualified hostname on CentOS 7.0?

How do I set the fully qualified hostname on CentOS 7.0? I have seen a few posts online for example using: $ sudo hostnamectl set-hostname nodename.domainname However, running domainname returns ...
Chris Snow's user avatar
  • 4,146
26 votes
4 answers
106k views

Understand hostname and /etc/hosts

In /etc/hostname, I have myname. In /etc/hosts, I have : 127.0.0.1 localhost.localdomain localhost myname ::1 localhost.localdomain localhost myname I have a vague understanding of what ...
Gradient's user avatar
  • 3,669
26 votes
4 answers
30k views

I changed my hostname, why is my bash PS1 prompt unchanged?

I changed my hostname by editing /etc/hostname and can see the new hostname using the hostname and hostname -F commands. But the shell prompt is still showing the old hostname. This is Ubuntu 11.0.4 ...
Dizzley's user avatar
  • 631
23 votes
9 answers
159k views

How to get the hostname along with the domain name?

In Unix (Solaris) is there any command that returns the hostname and domain name together? For instance: hostname -> servername domainname -> us.xyz.com I need : servername.us.xyz.com
user avatar
22 votes
3 answers
26k views

How do I get to use .local hostnames with Arch Linux?

If I'm using Ubuntu or Linux Mint (the only two flavours I've tried and know work for sure), I can run something like this: wayne@myhost$ ssh [email protected] And the name is automagically ...
Wayne Werner's user avatar
  • 11.8k
22 votes
1 answer
77k views

How to filter by host name in Wireshark?

Display filter in form ip.src_host eq my.host.name.com yields no matching packets, but there is traffic to and from this host. DNS name is resolved successfully, and filters using ip addresses like ip....
Petr Gladkikh's user avatar
20 votes
2 answers
14k views

Mac OS command to resolve hostnames like "getent" on Linux

I would like a command that will resolve a hostname to an IP address, in the same way that a normal program would resolve the hostname. In other words, it has to take into account mDNS (.local) and /...
user31708's user avatar
  • 407
19 votes
3 answers
60k views

How to change the hostname of a RHEL-based distro?

I logged in for the first time, opened terminal, and typed in ‘hostname’. It returned ‘localhost.localdomain.com’. Then I logged as the root user in terminal using the command, ‘su –‘, provided the ...
Thomas's user avatar
  • 1,713
19 votes
5 answers
46k views

What is sendmail referring to here?

When I install sendmail from the debian repos, I get the following output: Disabling HOST statistics file(/var/lib/sendmail/host_status). Creating /etc/mail/sendmail.cf... Creating /etc/mail/submit....
ixtmixilix's user avatar
  • 13.3k
19 votes
5 answers
31k views

Where does `hostname` store the hostname that I've set?

This is quite puzzling. Does anyone know where the hostname command stores and reads hostname from? I thought it was /etc/hostname but there is no such file on this Linux system that I'm using. I ...
user avatar
19 votes
1 answer
16k views

Wildcard in /etc/hosts file

It seems that wildcards are not supported in the /etc/hosts file. What is the best solution for me to resolve all *.local domains to localhost?
Peter Smit's user avatar
  • 1,164
18 votes
5 answers
181k views

I got error "hostname: Name or service not known" when checking IP of hostname

I'm running Ubuntu 14.04 on my company's cloud service (my instance has elastic IP).  I want to check out the IP address of my instance I'm running by command line, but it didn't work. root@ubuntu14-...
The One's user avatar
  • 4,942
17 votes
3 answers
11k views

Does a computer system (Linux) only have one host name?

hostname is used to display the system's DNS name, and to display or set its hostname or NIS domain name. Does a computer system (Linux) only have one host name? In virtual hosting, several host ...
Tim's user avatar
  • 103k
17 votes
2 answers
7k views

What are the ramifications of setting the hostname?

I have several Amazon EC2 servers and I'm using Chef to manage the configuration. I'd like to set the hostname so that the default bash prompt is more helpful. Right now after launching a new server ...
cwd's user avatar
  • 45.6k
16 votes
3 answers
279k views

Hostname and IP address mapping in /etc/hosts

In my linux machine, when I run hostname, it shows mongodb, but when I run host mongodb, it shows: mongodb@mongodb:/var/hadoop/hadoop-1.2.1/bin$ host mongodb Host mongodb not found: 2(SERVFAIL) My /...
wuchang's user avatar
  • 8,057
16 votes
2 answers
2k views

Host name changed remotely by wifi?

Am am currently visiting TU Wien and today I connected my Debian Linux laptop to their eduroam wlan using wpa_supplicant and the credentials of my home institute - as always when I am visiting another ...
cgogolin's user avatar
  • 263
15 votes
3 answers
5k views

What's the default file for `hostname`?

Heyo! I'm currently working on a non-lfs system from scratch with busybox as the star. Now, my login says: (none) login: Hence, my hostname is broken. hostname brings me (none) too. The guide I was ...
Bobbbay's user avatar
  • 411
15 votes
4 answers
13k views

preseed.cfg ignoring hostname setting

I am installing Debian Wheezy (netinstall) in VirtualBox using preseed.cfg. I tried both d-i netcfg/get_hostname string somehost and d-i netcfg/get_hostname string somehost, but in both cases the ...
ToddM's user avatar
  • 151
14 votes
1 answer
33k views

linux hostname -f command is not working on RHEL

I am running a RHEL 5.7 and the hostname command gives me the correct hostname. But hostname -s and hostname -f return: Unknown host. Why?
redoc's user avatar
  • 183
14 votes
2 answers
3k views

How can you determine the hostname associated with an IP on the network?

How can you determine the hostname associated with an IP on the network? (without configuring a reverse DNS) This was something that I thought was impossible. However I've been using Fing on my ...
Philip Couling's user avatar
14 votes
1 answer
7k views

Check presence of a hostname under custom port in known_hosts

I need to add a check if the hostname is already present in the known_hosts file. Normally I would do something like that: ssh-keygen -H -F hostname However, that does not seem to work for me in this ...
deimos's user avatar
  • 693
13 votes
2 answers
63k views

Shell command/script to see if a host is alive?

I'm trying to figure out more ways to see if a given host is up, solely using shell commands (primarily bash). Ideally, it would be able to work with both hostnames and IP addresses. Right now the ...
RICK's user avatar
  • 389
12 votes
4 answers
34k views

Changing hostname reboot reverts back to original

So, What I'm trying to do is simply change the hostname permanently. I can update the hostname but when a reboot is issued the original hostname is used! I'm aware there is a file hostname located at: ...
dan983's user avatar
  • 311
12 votes
2 answers
16k views

What's the use for the special ipv6 addresses in /etc/hosts?

I have the following block in my /etc/hosts: # The following lines are desirable for IPv6 capable hosts ::1 localhost ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::...
Gaslight Deceive Subvert's user avatar
12 votes
3 answers
4k views

What determines the Linux hostname?

In the few years I've been using Linux as my main system, specifically Fedora, I've always seen my hostname set to just "localhost", with the exception of when I connect to some networks and it ...
fedora's user avatar
  • 361
12 votes
1 answer
1k views

Why does sudo need the loopback interface?

We were trying to install our software on an Ubuntu machine. To do so, we needed root privileges. Basically, all we needed to do was run a runnable jar like: sudo java -jar runnableJar.jar. All such ...
Sriram's user avatar
  • 403
12 votes
3 answers
1k views

How to change a hostname

During Debian installation, I set my hostname to the wrong value, and now I would like to correct that.
tshepang's user avatar
  • 66.1k
11 votes
1 answer
3k views

How is an Elastic IP address different from a static IP address?

More of a Amazon Web Services EC2 question, hopefully not too off topic. I have a vanilla Ubuntu instance with them, and powered it off. On reboot couldn't ssh to the FQDN because the external IP ...
Thufir's user avatar
  • 1,910
11 votes
3 answers
40k views

How does traceroute resolve names?

While writing a script, I wanted to reference a machine by the computer name that I gave it (e.g. "selenium-rc"). I could not ping it using "selenium-rc", so I tried the following commands to see if ...
Keith Bentrup's user avatar
10 votes
2 answers
30k views

How do I fix my problem with hostnamectl command. It cannot connect to dbus

I am running Debian 9.4. hostname works. $ sudo strace -f hostnamectl ...snipped... connect(3, {sa_family=AF_UNIX, sun_path="/var/run/dbus/system_bus_socket"}, 33) = -1 ENOENT (No such file or ...
Bon Ami's user avatar
  • 893
10 votes
2 answers
20k views

Using DNSMasq for Local Hostname Resolution

I'm working on setting up a home intranet for me and my roommates. My idea is that we'll be able to store things like past utility bills in a place that's more accessible than a drawer in the kitchen ...
c.maclean's user avatar
  • 201
9 votes
5 answers
53k views

Mac OS X Terminal Equivalent for Host Name Info

In Linux, using a Bash Terminal, I can do: hostname -d to display the name of the DNS domain, and hostname -i to display the network address(es) of the hostname . How can I retrieve the same ...
marshki's user avatar
  • 617
9 votes
2 answers
27k views

A command that gives username@hostname:pwd

I know that pwd gives the current working directory, hostname gives the current host and whoami gives the current user. Is there a single unix command that will give me the output of whoami@hostname:...
Hooked's user avatar
  • 1,373
9 votes
1 answer
3k views

How to deal with underscores in hostnames?

I got DNS set up on my company's server and it works just fine, except I got problem with some phones. For example one of the phones is “Huawei P9 lite”, and it's hostname (set on the phone, no chance ...
FilipK's user avatar
  • 131
8 votes
2 answers
65k views

How to add an IP to hostname file

I have a Centos 5.8 server. How can I add my server IP address 192.168.20.254 so that it reflects when I run the command hostname -i At the moment the command only shows the loopback IP 127.0.0.1 and ...
Paddington's user avatar
8 votes
3 answers
6k views

uname -n vs hostname

What is the difference between uname -n and hostname? Are there any real differences in what they return? Are there any differences in availability on different OSes? Is one of them included in POSIX ...
Sildoreth's user avatar
  • 1,894
8 votes
2 answers
19k views

Determine FQDN when hostname doesn't give it?

In another question, I found that Puppet was generating certificates for my machine's FQDN but not the simple host name. In that example, kungfumaster was the hostname and was the value retrieved by ...
Naftuli Kay's user avatar
  • 40.1k
8 votes
4 answers
35k views

Avoid overwriting of hostname by transient hostname at reboot

My server is CentOS 7.1. After reboot the hostname is overwritten by the transient hostname (mail) and I can't find a way to avoid that. Maybe AutoDNS and the MX record mail causes that? /etc/...
hellcode's user avatar
  • 742
8 votes
1 answer
7k views

Set hostname on first boot before network.service

I have a firstboot.service that, from a stock OS image creates a unique hostname based on the MAC of the primary ethernet adapter. It runs as expected during boot but the hostname that gets ...
thom_nic's user avatar
  • 567
8 votes
4 answers
12k views

"Unable to resolve hostname" - how to cleanly change hostname without rebooting

At work, I work on a small website using Ubuntu servers hosted on Amazon EC2 instances. We have two webservers, and at any given time one of them is 'live' and one is 'testing', but when we've got our ...
Mark Amery's user avatar
  • 3,020
7 votes
5 answers
3k views

resolve all ip addresses in command output using standard command line tools

I have several log files that contain a bunch of ip addresses. I would love to be able to pipe the data through a program that would match and resolve ip addresses. I.E. cat /var/log/somelogfile | ...
Daniel's user avatar
  • 1,167

1
2 3 4 5
8