2018-01-29 更新
適用於 macOS 10.13.2
來一點嘻嘻哈哈的配色吧!
1 | PS1="\[\033[1;31m\]\t\[\033[0m\] \[\033[1;33m\]\u\[\033[0m\] \[\033[1;32m\]\h\[\033[0m\] \[\033[1;34m\]\w\[\033[0m\] ? " |
但建議還是把 emoji 拿掉,我在 iTerm2 換行會怪怪的
2015-07-13
因為買了新電腦,想把command prompt改得比較實用一點,發現自己完全忘記怎麼改了,再度驗證了考LPIC是沒有用的XD
Mac的個人command prompt檔案位置在 ~/.bash_profile
如果沒看到的話,自己打開隱藏檔,如果還是沒看到的話就自己nano一個新的
sudo nano ~/.bash_profile
重新讀取 .bash_profile 指令:
source ~/.bash_profile
目前的prompt:
export PS1=”[$(date +%k:%M:%S)] \u@\h \w $”
範例顯示:
[ 1:55:58] tvpsh2020@JimmyRetina ~ $
總共有哪些指令要另外爬文找了,參考文獻裡面有
—參考文獻—
[1] How to reload .bash_profile from the command line? – http://stackoverflow.com/questions/4608187/how-to-reload-bash-profile-from-the-command-line
[2] How to suppress (or customize) Mac Terminal shell prompt – http://stackoverflow.com/questions/14416274/how-to-suppress-or-customize-mac-terminal-shell-prompt
[3] Bash Shell PS1: 10 Examples to Make Your Linux Prompt like Angelina Jolie – http://www.thegeekstuff.com/2008/09/bash-shell-ps1-10-examples-to-make-your-linux-prompt-like-angelina-jolie/
[4] Customize Your Shell & Command Prompt – http://blog.taylormcgann.com/tag/prompt-color/
[5] [Unix] 讓Bash增添色彩 與 多字元換行問題 – http://blog.xuite.net/sphjlc062218/thinking/63628944-%5BUnix%5D+%E8%AE%93Bash%E5%A2%9E%E6%B7%BB%E8%89%B2%E5%BD%A9+%E8%88%87+%E5%A4%9A%E5%AD%97%E5%85%83%E6%8F%9B%E8%A1%8C%E5%95%8F%E9%A1%8C
搶先發佈留言