Useful Linux Setup

Nice prompt with git branch + free space

Add those in ~/.bashrc

source ~/.bashrc to see changes immidiately

 

function parse_git_dirty { [[ -z $(git status --porcelain 2>/dev/null) ]] || echo " DIRTY " }

function get_free_dev_space { echo "$(df -Ph . | tail -1 | awk '{print $4}')" }

function print_current_branch { echo "$(git branch 2>/dev/null | grep '^*' | colrm 1 2)" }

PATH="$PATH:$HOME/dev/toolsdq:$HOME/dev/scripting" PS1="[\033[0;32m][\033[0m\033[0;32m]\u\e[35m@[\033[0;36m]\h \e[35m[\e[31m\w\e[35m] \e[35m[\e[34m\t\e[35m] \e[35m[\e[32m\$(print_current_branch) \$(parse_git_dirty)\e[35m] [\e[94m\$(get_free_dev_space)\e[35m]\n[\033[0;32m]└─[\033[0m\033[0;32m] $[\033[0m\033[0;32m] ▶[\033[0m] "

Pubblicato da adec

I'm a computer science engineer, Rome, Italy.

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.