Custom shell prompt tips and tricks? - eviltoast

Recently I stumbled over an article, about how to customize your shell prompt. What really surprised me, is that it lacked one of the most basic tips I learned nearly 20 years back: Always display a timestamp in the prompt, to be able to check how long a process is running or when it ended. (Don’t need it daily, but every so often it saves my butt. ;-)) The other trick is to always have a colorful prompt, to easily discern where output from programs start/stop. In total my PS1 looks like this (with GIT status at the end): [\e[32m]\u[\e[m]@[\e[35m]\h[\e[m] [\e[36m]\A[\e[m] [\e[37m][[\e[m][\e[31m]\w[\e[m][\e[37m]][\e[m]$(__git_ps1 “(%s)”)$

My question is, what customization, tips and tricks do you have for the shell prompt?

  • wolf@lemmy.zipOP
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    Thanks, of course the color escapes are the first thing I ran into yesterday, when I played around with prompt functions. ;-)

    Porting your prompt command to another language is a very nice and practical little project, perhaps I will give it a go with Go. (Pun intended ;-))

    Have a great week!