8 Useful and Interesting Bash Prompts

3 comments

  1. Rick

    A good resource for Bash and zsh prompts is Liquid Prompt, a “useful adaptive prompt for Bash & zsh” ( https://github.com/nojhan/liquidprompt ). It allows for customizing the prompt not only with many of the items in this article, but many other items as well. And there are *dozens* of user-contributed configurations that are easy to install. And, of course, one can always make adjustments to any of those configurations, as well as create one’s own. I’ve been using it for a while now and wouldn’t go back.

  2. Joe S.

    I run a raspberry pi zero wh as a gadget mode development box and really like to know what is going on being such a limited cpu/mem. so in bash I create a few aliases and set the prompt as follows.#
    echo ”
    T=Temp in degrees C
    F=Free memory in megabyte
    S=Amount Swapped in megabyte
    L=Current load
    “;
    alias cpu_temp=’/opt/vc/bin/vcgencmd measure_temp|cut -b 6-9′;
    alias free_mem=’free -m | grep Mem: | tr -s ” ” | cut -d ” ” -f 4′;
    alias swap_used=’free -m | grep Swap: | tr -s ” ” | cut -d ” ” -f 3′;
    alias cpu_load=’cat /proc/loadavg | cut -d ” ” -f 1′;
    PS1=’${debian_chroot:+($debian_chroot)}\h:\w:\[\033[35m\]T`cpu_temp`\[\033[m\]:\[\033[36m\]F`free_mem`\[\033[m\]:\[\033[32m\]S`swap_used`\[\033[m\]:\[\033[34m\]L`cpu_load`\[\033[m\] \$ ‘;

    Then the prompt looks something like this….
    PiZeroWH:~:T41.2:F126:S0:L0.13 #
    but with color… I like it alot!

Comments are closed.