Why does the hostname command's output differ from /etc/hosts?

xmllmx
[root@localhost ~]# hostname hello
[root@localhost ~]# hostname
hello
[root@localhost ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@localhost ~]# 

The command line output is as above.

Why is the hostname output different from what is found in /etc/hosts?

countermode

The system hostname is not set using the file /etc/hosts.

The hostname is set using the system configuration management system. Where the hostname is stored persistently depends on the distribution. For instance, on my kali machine the hostname is stored in the file /etc/hostname from where it is read during startup; on my gentoo machine it is stored in /etc/conf.d/hostname.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Why does the input and output for cufft greatly differ from traditional fft?

Why does piped FFMPEG output differ from an explicit file?

Why does command prompt import differ from sublime text import?

why does my convolution routine differ from numpy & scipy's?

Why does my output differ for this code snippet?

Why does hostname appear in wmic output of netuse?

Why does update in crypto-js output differ from NodeJS' crypto when updating IntArray

Why does tar's handling of stdout and - differ?

Why does sed command output "char 5: unterminated `s' command"

Why does the content through HttpURLConnection getInputStream differ from the content through Linux command curl or wget?

Why isn’t the hostname command getting the FQDN from /etc/hostname?

Why does my forked process's parent pid differ from the parent's own pid?

Why does Haskell's Monad implementation fail function result differ from error's result?

Why does the Blowfish output in Java and PHP differ by only 2 chars?

Why does "pgrep -a" output differ depending on how a file is opened?

Why does Crystal's macro syntax for iterating differ from the rest of Crystal

Why does cmake's installed files differ from the actual built binary?

Why does DoubleStream.sum()'s result differ from straight addition?

Android: Why does the calculated available space differ from Android's displayed available space

Why does LogisticRegressionCV's .score() differ from cross_val_score?

Why does timestamp differ?

How does /bin/bash -c differ from executing a command directly?

Why does the result from evaluate() differ from last epoch result?

Why does docker image content differ from the container created from it?

How does Firestore's memcache differ from that of App Engine's

Why does the filtered date range differ from my start date?

Why does the "Total Time" column in visualvm differ from runtime duration?

Why does the scroll event in JavaScript differ from device to device?

How is RealMemory (slurmd -C) calculated? Why does it differ from MemTotal?