Most of our work on shell prompt.

By Default, PS1 is little bit boring.

is little bit boring. I’ll show you how to add useful information on your shell prompt

Alert Prompt (PS1)

Alert Prompt (PS1) change your shell color to RED when your previous command exit status is non zero.

[ root@miteshshah.github.io ~]# PS1 = " \` if [ \$ ? = 0 ]; then echo \[\e [34m \] ^_^[ \u @ \h : \w ] \\ $\ [ \e [0m \] ; else echo \[\e [31m \] O_O[ \u @ \h : \w ] \\ $\ [ \e [0m \] ; fi \` "

[ root@miteshshah.github.io ~]# PS1 = '\[\033[0;32m\]┌──\[\033[0;36m\]\u@\h\[\033[0m\033[0;32m\]─┤├─ \[\033[0m\]\t \d\[\033[0;32m\] ─┤├─ \[\033[0;31m\]\w\[\033[0;32m\] ─┤

\[\033[0;32m\]└──▶ \$\[\033[0m\] ' ┌──root@miteshshah─┤├─ 11:18:43 Thu Jun 25 ─┤├─ ~ ─┤ └──▶ #

Generate Prompt Online

By using http://bashrcgenerator.com/ you can generate your prompt easily.

NOTE!: For more detailed information use man bash and search for PROMPTING.

Post Navigation