Etikettarkiv: bash

Configure zsh in Byobu

Most Linuxen these days runs bash as their native shell. While Bash is OK it’s not my favourite actually. I’ve always been partial to zsh which for example has outstanding completion qualities that Bash totally misses.

If you run byobu which is an add-on for tmux or screen with lots of nifty features then you should perhaps want to configure it for zsh as it’s standard shell.

This works if you are using tmux rather than screen as your terminal multiplexer.

It’s easy if you know what to do. So open an editor and edit the file:

~.byobu/.tmux.conf

Then enter the following:

set -g default-shell /bin/zsh
set -g default-command /bin/zsh

Save the file, restart your byobu and everything should be daddy-o.

 

Your favourite prompt

Today’s Bash tip. Create a prompt that changes face depending on the return code of your last command. As long as the return code is OK you get a happy face. When it is false you get a sad one.

Open and edit the .bashrc file in your home directory and enter the following:

PS1="\u@\h:\[\e[33m\]\w\[\e[0m\] \[\`if [[ \$? = "0" ]]; \
then echo '\e[32m=)\e[0m'; else echo '\e[31m=(\e[0m' ; fi\`\] \$ "

Have fun.