archlinux改变终端文字的颜色提高效率文档格式.docx
- 文档编号:17977284
- 上传时间:2022-12-12
- 格式:DOCX
- 页数:9
- 大小:17.95KB
archlinux改变终端文字的颜色提高效率文档格式.docx
《archlinux改变终端文字的颜色提高效率文档格式.docx》由会员分享,可在线阅读,更多相关《archlinux改变终端文字的颜色提高效率文档格式.docx(9页珍藏版)》请在冰豆网上搜索。
改变后的效果见附图。
######################################################################################
方法二:
其实可以直接用gentoo的来替换arch的,显示效果会更好。
1,改变普通用户的:
用gentoo中的.bashrc文件中的内容替换.bashrc里的全部内容
2,改变root用户的:
用gentoo中的/etc/bash/bashrc文件中的内容替换/etc/bash.bashrc中的全部内容。
同样是重新打开终端。
效果见附图。
gentoo的.bashrcCODE:
#/etc/skel/.bashrc
#
#Thisfileissourcedbyall*interactive*bashshellsonstartup,
#includingsomeapparentlyinteractiveshellssuchasscpandrcp
#thatcan'
ttolerateanyoutput.Somakesurethisdoesn'
tdisplay
#anythingorbadthingswillhappen!
#Testforaninteractiveshell.Thereisnoneedtosetanything
#pastthispointforscpandrcp,andit'
simportanttorefrainfrom
#outputtinganythinginthosecases.
if[[$-!
=*i*]];
then
#Shellisnon-interactive.Bedonenow!
return
fi#Putyourfunstuffhere.
gentoo的/etc/bash/bashrcCODE:
#/etc/bash/bashrc
fi#Bashwon'
tgetSIGWINCHifanotherprocessisintheforeground.
#Enablecheckwinsizesothatbashwillchecktheterminalsizewhen
#itregainscontrol.#65623
#s.cwru.edu/~chet/bash/FAQ(E11)
shopt-scheckwinsize#Enablehistoryappendinginsteadofoverwriting.#139609
shopt-shistappend#ChangethewindowtitleofXterminals
case${TERM}in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*|interix)
PROMPT_COMMAND='
echo-ne"
\033]0;
${USER}@${HOSTNAME%%.*}:
${PWD/#$HOME/~}\007"
'
;
screen)
\033_${USER}@${HOSTNAME%%.*}:
${PWD/#$HOME/~}\033\\"
esacuse_color=false#SetcolorfulPS1onlyoncolorfulterminals.
#dircolors--print-databaseusesitsownbuilt-indatabase
#insteadofusing/etc/DIR_COLORS.Trytousetheexternalfile
#firsttotakeadvantageofuseradditions.Useinternalbash
#globbinginsteadofexternalgrepbinary.
safe_term=${TERM//[^[:
alnum:
]]/?
}#sanitizeTERM
match_lhs="
"
[[-f~/.dir_colors]]&
amp;
&
match_lhs="
${match_lhs}$(&
lt;
~/.dir_colors)"
[[-f/etc/DIR_COLORS]]&
/etc/DIR_COLORS)"
[[-z${match_lhs}]]\
type-Pdircolors&
gt;
/dev/null\
match_lhs=$(dircolors--print-database)
[[\n'
${match_lhs}==*\n'
TERM"
${safe_term}*]]&
use_color=trueif${use_color};
#Enablecolorsforls,etc.Prefer~/.dir_colors#64489
iftype-Pdircolors&
/dev/null;
if[[-f~/.dir_colors]];
eval$(dircolors-b~/.dir_colors)
elif[[-f/etc/DIR_COLORS]];
eval$(dircolors-b/etc/DIR_COLORS)
fi
fiif[[${EUID}==0]];
PS1='
31m\]\h\[\033[01;
34m\]\W\$\[\033[00m\]'
else
32m\]\u@\h\[\033[01;
34m\]\w\$\[\033[00m\]'
fialiasls='
aliasgrep='
grep--colour=auto'
if[[${EUID}==0]];
#showroot@whenwedon'
thavecolors
\u@\h\W\$'
\u@\h\w\$'
fi#Trytokeepenvironmentpollutiondown,EPAlovesus.
unsetuse_colorsafe_termmatch_lhs
archlinux官方wiki上的說明:
Generalizingcolorsforallusers
Ifyouwanttogeneralizetheuseofcolorsforallusersinthesystem,youmustmodifythe/etc/bash.bashrcfileandcreatea/etc/DIR_COLORSfile.HereisapossiblegeneralizationoftheGentoocolorschemeforArchlinux:
/etc/bash.bashrc:
#/etc/bash.bashrc
#https:
//wiki.archlinux.org/index.php/Color_Bash_Prompt
#outputtinganythinginthosecases.if[[$-!
#Shellisnon-interactive.Bedonenow!
return
shopt-shistappendcase${TERM}in
xterm*|rxvt*|Eterm|aterm|kterm|gnome*)
PROMPT_COMMAND=${PROMPT_COMMAND:
+$PROMPT_COMMAND;
}'
printf"
%s@%s:
%s\007"
"
${USER}"
${HOSTNAME%%.*}"
${PWD/#$HOME/~}"
;
screen)
\033_%s@%s:
%s\033\\"
esac#Fortuneisasimpleprogramthatdisplaysapseudorandommessage
#fromadatabaseofquotationsatlogonand/orlogout;
#type:
pacman-Sfortune-mod"
toinstallit,thenuncommentthe
#followinglines:
#if["
$PS1"
];
#/usr/bin/fortune
#fi#SetcolorfulPS1onlyoncolorfulterminals.
#globbinginsteadofexternalgrepbinary.#Dynamicallymodifiedvariables.Donotchangethem!
use_color=false
#sanitizeTERM:
}
[[-z${match_lhs}]]&
/dev/null&
[[$'
\n'
${match_lhs}==*$'
#Enablecolorsforls,etc.Prefer~/.dir_colors#64489
iftype-Pdircolors&
if[[-f~/.dir_colors]];
eval$(dircolors-b~/.dir_colors)
elif[[-f/etc/DIR_COLORS]];
eval$(dircolors-b/etc/DIR_COLORS)
fi
fiif[[${EUID}==0]];
PS1='
else
fialiasls='
aliasdir='
dir--color=auto'
aliasgrep='
if[[${EUID}==0]];
#showroot@whenwedonothavecolors
fi
fiPS2='
'
PS3='
PS4='
+'
#Trytokeepenvironmentpollutiondown,EPAlovesus.
unsetuse_colorsafe_termmatch_lhs[-r/etc/bash_completion]&
./etc/bash_completion
/etc/DIR_COLORS:
#Configurationfileforthecolorlsutility
#Thisfilegoesinthe/etcdirectory,andmustbeworldreadable.
#Youcancopythisfileto.dir_colorsinyour$HOMEdirectorytooverride
#thesystemdefaults.#COLORneedsoneofthesearguments:
tty'
colorizesoutputtottys,butnot
#pipes.'
all'
addscolorcharacterstoalloutput.'
none'
shutscolorization
#off.
COLORall#Extracommandlineoptionsforlsgohere.
#Basicallytheseonesare:
#-F=show'
/'
fordirs,'
*'
forexecutables,etc.
#-T0=don'
ttrusttabspacingwhenformattinglsoutput.
OPTIONS-F-T0#Below,thereshouldbeoneTERMentryforeachtermtypethatiscolorizable
TERMlinux
TERMconsole
TERMcon132x25
TERMcon132x30
TERMcon132x43
TERMcon132x60
TERMcon80x25
TERMcon80x28
TERMcon80x30
TERMcon80x43
TERMcon80x50
TERMcon80x60
TERMxterm
TERMvt100
TERMrxvt
TERMrxvt-256color
TERMrxvt-cygwin
TERMrxvt-cygwin-native
TERMrxvt-unicode
TERMrxvt-unicode-256color
TERMrxvt-unicode256#EIGHTBIT,followedby'
1'
foron,'
0'
foroff.(8-bitoutput)
EIGHTBIT1#Belowarethecolorinitstringsforthebasicfiletypes.Acolorinit
#stringconsistsofoneormoreofthefollowingnumericcodes:
#Attributecodes:
#00=none01=bold04=underscore05=blink07=reverse08=concealed
#Textcolorcodes:
#30=black31=red32=green33=yellow34=blue35=magenta36=cyan37=white
#Backgroundcolorcodes:
#40=black41=red42=green43=yellow44=blue45=magenta46=cyan47=white
NORMAL00#globaldefault,althougheverythingshouldbesomething.
FILE00#normalfile
DIR01;
34#directory
LINK01;
36#symboliclink
FIFO40;
33#pipe
SOCK01;
35#socket
BLK40;
33;
01#blockdevicedriver
CHR40;
01#characterdevicedriver#Thisisforfileswithexecutepermission:
EXEC01;
32#Listanyfileextensionslike'
.gz'
or'
.tar'
thatyouwouldlikels
#tocolorizebelow.Puttheextension,aspace,andthecolorinitstring.
#(andanycommentsyouwanttoaddaftera'
#'
)
.cmd01;
32#executables(brightgreen)
.exe01;
32
.com01;
.btm01;
.bat01;
.tar01;
31#archivesorcompressed(brightred)
.tgz01;
31
.arj01;
.taz01;
.lzh01;
.zip01;
.z01;
.Z01;
.gz01;
.jpg01;
35#imageformats
.gif01;
35
.bmp01;
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- archlinux 改变 终端 文字 颜色 提高效率
![提示](https://static.bdocx.com/images/bang_tan.gif)