一、修改偏好設置
打開terminal,左上角終端-》偏好設置,打開如下:
點擊“Profiles”——》左側列表中選擇喜歡的樣式——》點擊“Default”,如下圖:
二、偏好設置里設置的字體顏色是指所有的字體的顏色,如果希望不同文件用不同顏色顯示,需執行以下操作
進入~目錄。 $ cd ~
編輯.bash_profile配置文件。 $ vim .bash_profile
輸入i(英文輸入狀態下),進入編輯狀態
編輯好,按Ese,然后按:wq(英文輸入狀態),保存並退出
讓設置生效,輸入 $ source .bash_profile
查看設置效果 $ ls
PS:我的在運行了$ source .bash_profile,之后,依然沒有改變顯示;
mac跟linux/unix的操作命令同屬一族,很多地方相似,比如都存在:~/.bash_profile
~/.bashrc #這個我沒有找到
mac的默認terminal是zsh,其也有一個對應的文件 ~/.zshrc,這個文件是每次打開terminal都會執行的,但前兩者則不然;
但我們一般在前兩者中設置alias(其實在/zshrc中設置也可以)以及文件夾和目錄顏色設置等,如果要保證設置在每次打開terminal時都會生效,
我們可以在.zshrc中添加source ~/.bashrc或者source ~/.bash_profile
PS:放上我的 ~/.zshrc和~/.bash_profile文件,如下:
(1)~/.zshrc:
# HomeBrew
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PATH=/Users/mayl/Library/Python/3.8/bin/:$PATH
export PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" #load RVM into a shell session *as a function*
export PS1='%n@%m %1~ %#' #%n 當前用戶的賬號名稱
export LS_OPTIONS='--color=auto' #如果沒有指定,則自動選擇顏色
export CLICOLOR='Yes' #是否輸出顏色
export LSCOLORS='CxfxcxdxbxegedabagGxGx' #指定顏色
#grep
alias grep='grep --color=always'
#ls
alias ll='ls -l'
source ~/.bash_profile
# HomeBrew END
(2)~/.bash_profile
# HomeBrew
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles
export PATH="/usr/local/bin:$PATH"
export PATH="/usr/local/sbin:$PATH"
export PATH="/Users/mayl/Library/Python/3.8/bin"
export PATH=/bin:/usr/bin:/usr/local/bin:${PATH}
#[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" #load RVM into a shell session *as a function*
export PS1='%n@%m %1~ %#' #%n 當前用戶的賬號名稱
export LS_OPTIONS='--color=auto' #如果沒有指定,則自動選擇顏色
export CLICOLOR='Yes' #是否輸出顏色
export LSCOLORS='CxfxcxdxbxegedabagGxGx' #指定顏色
#grep
alias grep='grep --color=always'
#ls
alias ll='ls -l'
#for color
#export CLICOLOR=1
#黑色背景用以下命令
#export LSCOLORS=GxFxCxDxBxegedabagaced
#export LSCOLORS=GaFaCaDaBaegedabagaced
#白色背景用以下命令
#export LSCOLORS=ExFxBxDxCxegedabagacad
#終端默認顏色 exfxcxdxbxegedabagacad
#下面給出的各個字母代表指代的不同顏色
#a black
#b red
#c green
#d brown
#e blue
#f magenta 洋紅
#g cyan 青色
#h light grey
#A bold black, usually shows up as dark grey 粗體黑色,通常顯示為深灰色
#B bold red
#C bold green
#D bold brown, usually shows up as yellow
#E bold blue
#F bold magenta
#G bold cyan
#H bold light grey; looks like bright white
#x default foreground or background
# HomeBrew END
參考:https://jingyan.baidu.com/article/ce43664948bd093772afd373.html
https://blog.csdn.net/orangleliu/article/details/41902851