如何修复在终端中显示Android主机名的MacBook? [英] How to fix MacBook showing Android hostname in Terminal?

查看:113
本文介绍了如何修复在终端中显示Android主机名的MacBook?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我经常使用终端,由于某种原因,终端突然在提示中显示了奇怪的android-1e1c8882e08308f9主机名(见图片).

I use terminal quite often, for some reason all of a sudden Terminal is showing a strange android-1e1c8882e08308f9 hostname (see image) in the prompt.

我已经在共享首选项"中检查了MacBook的主机名,这是正确的,但是终端仍显示android主机名.

I've checked my MacBook's hostname in Sharing Preferences and this is correct, but Terminal is still showing the android hostname.

有人可以建议吗?

谢谢

推荐答案

默认情况下,未设置计算机的主机名.通过共享"面板可以设置计算机名称,该名称是Mac OS X的特定属性.我的理论是,如果未设置主机名,则hostname(和您的shell提示符)将使用此值.以下是笔记本电脑上scutilhostname的输出.

By default, the host name of your computer is not set. The Sharing panel lets you set the computer name, which is a Mac OS X-specific attribute. My theory is that if the host name is not set, hostname (and your shell prompt) will use this value instead. The following is the output of scutil and hostname on my laptop.

patikoija ~ % scutil --get ComputerName
patikoija
patikoija ~ % scutil --get LocalHostName
patikoija
patikoija ~ % scutil --get HostName
HostName: not set
patikoija ~ % hostname
patikoija.local

当我访问公司办公室时,我的主机名也类似地设置为以"dhcp-"开头的名称.我想DHCP服务器设置了实际的主机名,然后运行scutil会显示该主机名.您可以尝试使用scutil设置计算机的真实主机名,并查看DHCP服务器是否抵抗"了它的覆盖.

When I visit my company's office, my host name is similarly set to something that begins with 'dhcp-'. I suppose that the DHCP server sets the actual host name, and running scutil there would show that name. You can try using scutil to set the true host name of your computer, and see if that "resists" efforts by the DHCP server to override it.

这篇关于如何修复在终端中显示Android主机名的MacBook?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆