exam questions

Exam 102-500 All Questions

View all questions & answers for the 102-500 exam

Exam 102-500 topic 1 question 1 discussion

Actual exam question from LPI's 102-500
Question #: 1
Topic #: 1
[All 102-500 Questions]

FILL BLANK -
Which command is used to set the hostname of the local system? (Specify only the command without any path or parameters.)

Show Suggested Answer Hide Answer
Suggested Answer: hostname

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Rsantos123
1 month, 1 week ago
The command is "hostname". Its required root permissions. hostname new-hostname
upvoted 2 times
...
iagor_ml
3 months, 3 weeks ago
The material says hostnamectl, but i tested on kali, apparently hostname name_to_set works
upvoted 1 times
...
ccpmad
1 year, 2 months ago
you can also use the hostname command to display the current hostname of the system. However, if you want to set the hostname, you should use hostnamectl on modern systems and hostname on older systems with the following syntax For modern systems: hostnamectl set-hostname new-hostname For older systems: hostname new-hostname note that in the original question, the command to set the hostname is requested, so in this case, the most appropriate command would be hostnamectl.
upvoted 2 times
...
karamazov
1 year, 3 months ago
Who should listen to it, the community vote or what the system throws?
upvoted 1 times
...
klever
1 year, 5 months ago
from the man page: hostnamectl may be used to query and change the system hostname and related settings.
upvoted 1 times
...
alextestwin
1 year, 7 months ago
hostnamectl
upvoted 1 times
...
lucaverce
2 years, 1 month ago
Using the hostnamectl is a better and permanent choice, but for name change is needed the sub-command "set-hostname" or "hostname" following the command. example: TestVM@Ubuntu-VM:~$ hostnamectl set-hostname TestVM2 this other form is accepted TestVM@Ubuntu-VM:~$ hostnamectl hostname TestVM3 So we will enter two command followed by an argument. MAN page for hostnamectl: HOSTNAMECTL(1) hostnamectl HOSTNAMECTL(1) NAME hostnamectl - Control the system hostname SYNOPSIS hostnamectl [OPTIONS...] {COMMAND} DESCRIPTION hostnamectl may be used to query and change the system hostname and related settings.
upvoted 3 times
...
lucaverce
2 years, 1 month ago
We can use the hostname command , but is not a permanent change, only 'til next reboot Man page for hostname: HOSTNAME(1) Linux Programmer's Manual HOSTNAME(1) NAME hostname - show or set the system's host name ... DESCRIPTION Hostname is used to display the system's DNS name, and to display or set its hostname or NIS domain name. ... >> Note, that this is effective only until the next reboot. >> Edit /etc/hostname for permanent change.
upvoted 1 times
...
jedrek
2 years, 2 months ago
Both hostname and hostname can set the hostname so why ask for one command? How are users supposed to 'guess' what command they had in mind? Anyway, from manual pages: # man hostname When called with one argument or with the --file option, the commands set the host name or the NIS/YP domain name. hostname uses the sethostname(2) function, while all of the three domainname, ypdomainname and nisdomainname use setdomainname(2). Note, that this is effective only until the next reboot. Edit /etc/hostname for permanent change. # man hostnamectl set-hostname NAME Set the system hostname to NAME.
upvoted 2 times
jedrek
2 years, 2 months ago
hostnamectl, typoo in first sentence.
upvoted 1 times
...
...
marenco
2 years, 3 months ago
the machine’s hostname can also be defined with the hostnamectl command. When supplied with sub-command set-hostname, command hostnamectl will take the name given as an argument and write it in /etc/hostname, so in this case the question is without parameters, will be HOSTNAME the answer
upvoted 1 times
...
Robert12
2 years, 4 months ago
Most of all Linux systems run on systemd , the answer is hostnamectl with the set-hostname option which will change the contents of the /etc/hostname file which defines the hostname of the machine.
upvoted 1 times
drliu1202
1 year, 10 months ago
"The /etc/hostname file can be edited directly, but the machine’s hostname can also be defined with the hostnamectl command. When supplied with sub-command set-hostname, command hostnamectl will take the name given as an argument and write it in /etc/hostname:" https://learning.lpi.org/en/learning-materials/102-500/109/109.2/109.2_01/#:~:text=The%20/etc/hostname%20file%20can%20be%20edited%20directly%2C%20but%20the%20machine%E2%80%99s%20hostname%20can%20also%20be%20defined%20with%20the%20hostnamectl%20command.%20When%20supplied%20with%20sub%2Dcommand%20set%2Dhostname%2C%20command%20hostnamectl%20will%20take%20the%20name%20given%20as%20an%20argument%20and%20write%20it%20in%20/etc/hostname%3A
upvoted 1 times
...
...
isaac_paul
2 years, 6 months ago
hostname is the correct answer
upvoted 3 times
drliu1202
1 year, 10 months ago
"There is also a command hostname, with which you can show or set the system’s host name." https://learning.lpi.org/en/learning-materials/010-160/2/2.1/2.1_01/#:~:text=There%20is%20also%20a%20command%20hostname%2C%20with%20which%20you%20can%20show%20or%20set%20the%20system%E2%80%99s%20host%20name.
upvoted 1 times
...
...
dimasaburov
2 years, 6 months ago
hostnamectl work only on systemd Linux systems, hostname work in all Linux systems.
upvoted 2 times
...
jegga
2 years, 7 months ago
The correct answer is hostnamectl Check "man hostnamectl"
upvoted 1 times
...
ca_tecnico
2 years, 9 months ago
systemctl
upvoted 1 times
...
Raul_Andre
3 years, 7 months ago
Hostname is the right answer for this question.
upvoted 2 times
HieuNguyen887
3 years, 1 month ago
you can use the hostnamectl instead
upvoted 2 times
...
...
linder
4 years ago
It also could be hostnamectl
upvoted 3 times
mustache
3 years, 10 months ago
yes, but it has options, I guess hostname will be the correct one for this question
upvoted 4 times
...
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago