我不知道如何禁用终端中的颜色(只是默认的,它被称为 gnu?)。找了一个小时并运行了一些我在其他地方看到的代码。还尝试了emacs ~/.bashrc并添加了一条应该禁用颜色的行,它工作了一次,然后我关闭了终端,再次ls,颜色又回来了。任何帮助都很棒!
Anw*_*war 11
在你的.bashrc文件中,你会发现行
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
force_color_prompt=yes
Run Code Online (Sandbox Code Playgroud)
在行#前放置一个注释符号force_color_prompt=yes并重新启动终端。更改后,该行应为
#force_color_prompt=yes
Run Code Online (Sandbox Code Playgroud)
编辑:这将从终端变成颜色。但是,如果某些程序内置了颜色支持,并且您也想关闭它们,请按照@Zanna 的回答进行操作。基本上你需要注释掉诸如alias ls='ls --color=auto'等的行。
Zan*_*nna 10
如果您设置了彩色提示,请参阅@Anwar 的回答
命令输出的颜色ls由别名构成。
要禁用此功能,请在您的 ~/.bashrc
alias egrep='egrep --color=auto'
alias fgrep='fgrep --color=auto'
alias grep='grep --color=auto'
alias ls='ls --color=auto'
Run Code Online (Sandbox Code Playgroud)
完成后,source ~/.bashrc立即生效或关闭终端并打开一个新终端
| 归档时间: |
|
| 查看次数: |
14081 次 |
| 最近记录: |