Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

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 (?) , you can switch to a simple comment.
Switch to a voting comment New
lucaverce
Highly Voted 1 year, 11 months ago
I took my exam today and I answer "systemctl" Passed with 800/800 (100% correct)
upvoted 8 times
k3n_
1 week, 3 days ago
The only way a ctl is involved with changing hostname is through: ~]# hostnamectl set-hostname name
upvoted 1 times
...
ngotru97
1 year, 10 months ago
How change with "systemctl" bro
upvoted 2 times
...
MaikyCR28
1 year, 10 months ago
Congrats bro. I'll take the exam in 3 weeks. I haven't almost found test exams to practice in Google. How did you got ready to take it?
upvoted 1 times
...
danny12233
1 year, 3 months ago
There is no way to set the hostname via systemctl, check the command line options for systemctl, hostname isn't mentioned. The answer is absolutely hostnamectl. don't speared misinformation
upvoted 3 times
lucaverce
1 year, 2 months ago
you're right
upvoted 1 times
...
...
...
Rini_Giannenzo
Highly Voted 3 years, 4 months ago
Anche hostnamectl lo fa [con meno sethostname
upvoted 6 times
...
iagor_ml
Most Recent 1 month, 3 weeks ago
The material says hostnamectl, but i tested on kali, apparently hostname name_to_set works
upvoted 1 times
...
Arielpetit
2 months, 3 weeks ago
I Wrote the exam and i had 820/800
upvoted 1 times
...
[Removed]
10 months, 2 weeks ago
hostnamectl
upvoted 1 times
...
ccpmad
1 year 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, 1 month ago
Who should listen to it, the community vote or what the system throws?
upvoted 1 times
...
klever
1 year, 3 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, 5 months ago
hostnamectl
upvoted 1 times
...
lucaverce
1 year, 11 months 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
1 year, 11 months 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 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 ago
hostnamectl, typoo in first sentence.
upvoted 1 times
...
...
marenco
2 years, 1 month 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, 2 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, 8 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, 4 months ago
hostname is the correct answer
upvoted 3 times
drliu1202
1 year, 8 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, 4 months ago
hostnamectl work only on systemd Linux systems, hostname work in all Linux systems.
upvoted 2 times
...
jegga
2 years, 4 months ago
The correct answer is hostnamectl Check "man hostnamectl"
upvoted 1 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 ...