Podcast
Questions and Answers
What is the purpose of the /etc/hostname file?
What is the purpose of the /etc/hostname file?
What is the maximum length of the static hostname?
What is the maximum length of the static hostname?
What is the main difference between the static hostname and the pretty hostname?
What is the main difference between the static hostname and the pretty hostname?
What is the purpose of the hostnamectl command with the set-hostname sub-command?
What is the purpose of the hostnamectl command with the set-hostname sub-command?
Signup and view all the answers
What is the transient hostname used for?
What is the transient hostname used for?
Signup and view all the answers
Study Notes
Hostname Configuration
- The
hostnamectl
command can be used to set the hostname of a system. - If neither
--pretty
nor--transient
option is used, all three hostname types (static, pretty, and transient) will be set to the given name. - The
--static
option can be used to set the static hostname only. - The static hostname is stored in the
/etc/hostname
file.
hostnamectl Command
- The
hostnamectl
command can be used to display various descriptive and identity bits of information about the running system. - The
status
sub-command can be omitted, as it is the default action of thehostnamectl
command.
System Information
- The
hostnamectl
command can display the following information:- Static hostname
- Pretty hostname
- Transient hostname
- Icon name
- Chassis
- Machine ID
- Boot ID
- Operating System
- Kernel
- Architecture
Name Service Switch (NSS)
- The NSS configuration file is
/etc/nsswitch.conf
. - The NSS configuration file is used to determine the sources for name-IP matches and to obtain name-service information in a range of categories, called databases.
- The
hosts
database keeps track of the mapping between host names and host numbers.
Modifying Hostname
- The
hostnamectl
command can be used to modify the hostname of a system. - The
--static
option can be used to set the static hostname only. - The
--pretty
option can be used to set a more descriptive name for the machine.
/etc/hosts File
- The
/etc/hosts
file associates host names with IP addresses. - The format of the
/etc/hosts
file is:IP address hostname alias
.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Learn about configuring hostnames in Linux systems using the hostnamectl command. Understand the different options to set static, pretty, and transient hostnames.