I have a terminal prompt that I use in almost every server I’m in. This isn’t a super flashy one, but it helps me easily find where I last entered a command or the start of an output because it’s colored and has that arrow pointing directly where I need to focus my attention.
┌[ jake@Jakes-iMac ] ~
└➤ Z-Shell
macOS changed over to Z-Shell as its default shell for the terminal application that comes with the operating system. Here’s how to do it in Z-shell.
First, you need to modify the configuration file for your instance of Z-shell.
nano ~/.zshrc
Then copy and paste this into that configuration file.
PROMPT='%F{26}┌%F{reset}[ %F{9}%n%F{reset}@%F{202}%m%F{reset} ] %F{26}%~%F{reset}
%F{26}└%F{reset}➤ '
BASH
Most everything else uses the Bourne Again Shell or BASH, so these are the applicable instructions for everything that’s not Mac.
First, you need to modify the configuration file for BASH.
nano ~/.bashrc
You’ll likely already have a good amount of default configurations in this file, so you just need to add this to the very end of the whole thing.
PS1='\[\e[0;38;5;27m\]┌\[\e[0m\][ \[\e[0;91m\]\u\[\e[0m\]@\[\e[0;38;5;202m\]\h \[\e[0m\]] \[\e[0;38;5;27m\]\W\n\[\e[0;38;5;27m\]└\[\e[0m\]➤ \[\e[0m\]'
Apply
To make the changes take effect, you can either log out and log back in again, or you can just enter this command below using whatever configuration file you have to import to apply the changes immediately. Here’s an example for BASH.
source ~/.bashrc