MacOS奇怪的终端提示,尝试重置终端 [英] MacOS Strange Terminal Prompt, Tried Resetting Terminal

查看:127
本文介绍了MacOS奇怪的终端提示,尝试重置终端的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

链接到终端图片



根据我连接的网络,我的终端在每行上列出奇怪的东西,例如engr2 -....。我不小心做了一件事造成了这个问题。一旦它开始发生,git命令停止工作。我试图删除终端的配置文件,但它只是重置我的终端的主题。 解决方案

是正常的,只是有点混乱。这是电脑的主机名。标准提示符包含它以帮助您。



在unix命令行界面中,切换到其他目录是正常的(使用 cd ),其他用户帐户(使用 su sudo ),甚至其他计算机(使用 ssh )。跟踪你的位置可能会引起混淆,因此标准shell提示包括你在哪里和你是谁(计算机的主机名,当前用户名和当前目录);类似于GPS系统的命令行。



问题是,它确定计算机主机名的方式有时会比其他任何事情造成更多混乱。这个过程有点像这样:

Bash shell:我需要在命令提示符中包含主机名。 嘿,操作系统:这台电脑的主机名是什么?



操作系统:我的主机名?天哪,我想知道那是什么。我知道,我会询问DNS(域名服务)服务器,如果它有我的IP地址的名称。 嘿,DNS,与2.2.79.41相关的名称是什么?



DNS服务器:2.2.79.41?这并没有真正的名称,它只是DHCP服务器向连接到工程网络的计算机发送的地址池的一部分。哦,我知道,我会称之为engr2-2-79-41-dhcp。它比没有好,是吧?



...所以DNS将该名称发送给操作系统,该操作系统将其传递给shell,该shell会在提示中显示出来,这会导致你说WTF就是那个。



请记住:这个过程的每一部分都是尽力做到最好的提供最好的信息,没有什么是真正的错误,如果你不知道它在做什么或为什么,它只是相当混乱。



这给我带来了你的问题git命令:这不会导致它,它几乎肯定与它无关。忽略奇怪的提示,并排除你的git设置。


Link to picture of terminal

Depending on what network I am connected to, my terminal lists odd things on every line such as "engr2-....". I accidentally did something that created this problem. Once it started occurring, git commands stopped working. I tried to delete configuration files for the terminal, but it only reset the theme of my terminal.

解决方案

What you're seeing is normal, just a bit confusing. It's the computer's hostname. The standard prompt includes it in an attempt to be helpful.

In the unix command-line interface, it's normal to switch to other directories (with cd), other user accounts (with su or sudo), and even other computers (with ssh). Keeping track of where you are can get confusing, so the standard shell prompt includes where and who you are (the computer's hostname, current username, and current directory); sort of the command-line equivalent of a GPS system.

The problem is that the way it determines the computer's hostname sometimes causes more confusion than anything else. The process goes a bit like this:

Bash shell: I need to include the hostname in the command prompt. "Hey, operating system: what's the hostname of this computer we're on?"

OS: My hostname? Gosh, I wonder what that is. I know, I'll ask the DNS (domain name service) server if it has a name for my IP address. "Hey, DNS, what's the name associated with 2.2.79.41?"

DNS server: 2.2.79.41? That doesn't really have a specific name, it's just part of the pool of addresses the DHCP server hands out to computers that connect to the engineering network. Oooh, I know, I'll call it engr2-2-79-41-dhcp. It's better than nothing, right?"

...so the DNS sends that name to the OS, which passes it to the shell, which displays it in your prompt, which causes you to say "WTF is that????".

Keep in mind here: every part of this process is something trying to do the best it can to provide the best information it can. Nothing is actually wrong, it's just rather confusing if you don't know what it's doing or why.

Which brings me to your problem with git commands: this is not causing it. It is almost certainly not related to it. Ignore the weird prompt, and troubleshoot your git setup.

这篇关于MacOS奇怪的终端提示,尝试重置终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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