Last active
December 19, 2015 10:29
-
-
Save jimrybarski/5940400 to your computer and use it in GitHub Desktop.
My command prompt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# first line: | |
# =========== | |
# user/host (red if root, white if not) | |
# number of files in the current directory | |
# total size of files in current directory | |
# second line: | |
# ============ | |
# green benzene symbol if previous command succeeded | |
# solid red hexagon if previous command failed | |
# this requires unicode support to work - if the terminal doesn't support unicode, it'll use green and red diamonds instead | |
BLACK='\e[0;30m' | |
BLUE='\e[0;34m' | |
GREEN='\e[0;32m' | |
CYAN='\e[0;36m' | |
RED='\e[0;31m' | |
PURPLE='\e[0;35m' | |
BROWN='\e[0;33m' | |
LIGHTGRAY='\e[0;37m' | |
DARKGRAY='\e[1;30m' | |
LIGHTBLUE='\e[1;34m' | |
LIGHTGREEN='\e[1;32m' | |
LIGHTCYAN='\e[1;36m' | |
LIGHTRED='\e[1;31m' | |
LIGHTPURPLE='\e[1;35m' | |
YELLOW='\e[1;33m' | |
WHITE='\e[1;37m' | |
NC='\e[0m' | |
export PROMPT_COMMAND=__prompt_command | |
__prompt_command() { | |
FILE_COUNT=$(ls -1 | wc -l | sed 's: ::g') | |
FILE_SIZE=$(ls -lah | grep -m 1 total | sed 's/total //') | |
PS1="$NC$(if [[ ${EUID} == 0 ]]; then echo -ne "$RED\u@\h$NC"; else echo -ne "\u@\h"; fi) ($LIGHTBLUE$FILE_COUNT$NC) ($LIGHTGREEN$FILE_SIZE$NC) [\w]\n$NC\$([[ \$? != 0 ]] && echo \"$RED⬢ $NC\" || echo \"$GREEN⌬ $NC\") " | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment