7

误删/home文件夹,导致Ubuntu命令行没有颜色怎么办?怎样把终端控制台的命令行颜色调...

 3 years ago
source link: https://blog.popkx.com/how-to-set-teminal-color-of-Ubuntu/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

误删/home文件夹,导致Ubuntu命令行没有颜色怎么办?怎样把终端控制台的命令行颜色调出?

发表于 2019-12-22 14:12:00   |   已被 访问: 300 次   |   分类于:   杂谈 , Linux笔记   |   暂无评论

因为误删了 /home/user 目录下的文件,导致 Ubuntu 终端命令行的颜色都没了,如下图:

虽然可以指定alas ls='ls --color=auto'(放入~/.bashrc)让 ls 命令输出的文件带上颜色,但是命令行本身却依然没有颜色:

此时可以在~/.bashrc中添加或者修改(请注意 PS1 关键字)如下内容:

注意 PS1 关键字

注意 PS1 关键字

PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '

之后保存执行

$ source ~/.bashrc

即可获得彩色的终端:

彩色的终端

彩色的终端

阅读更多:   杂谈 , Linux笔记


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK