Tom's Bash Prompt

Whenever Tom shows a Linux terminal session his bash prompt looks great. Does anyone know what his .bashrc settings are? I’ve been playing with http://bashrcgenerator.com/ and looking at reddit postings of other prompts, but I still like what Tom shows and my inability to reproduce it is frustrating.

Or, does anybody have something similar but even cooler to share with us?

I haven’t looked at his specifically but imho you can’t beat zsh as a shell with oh-my-zsh to skin it (tons of awesome themes). Just FYI,

Zsh is an extended Bourne shell with a large number of improvements, including some features of Bash, ksh, and tcsh."

It’s a good shell for developers and sysadmins, or so I hear. First thing I get personally.

Some links:

Tom has made at least one video about this in the past, he keeps his .bashrc and other files at https://github.com/flipsidecreations/dotfiles and he just pulls them down from github every time he goes to a new computer.

1 Like

I’ve forked both his and Phil’s dot files repos. Right now I’m adapting the install script to work with my Mac’s as well (fan boy stuff aside, you can’t beat the reliability of the older hardware!) since I run to MBRs and would like to add an older iMac in the future. I’ll be putting it up on my GH account (if I can ever remember to push) if anyone cares. Eventually I might even do a PR for others in @LTS_Tom’s and Phil’s downstream can benefit from the Mac OS script, because why not? Lol

1 Like

I use Toms dotfiles - makes things a lot easier to read in Putty etc.

If you install the dotfiles sometimes for some reason it doesnt always work until after a reboot but if you do : ~/.bash that will restart the shell and the dotfiles will have then taken effect.

@LTS_Tom uses something like sexybash because I kinda remember setting it up for him :wink: :smiling_face_with_three_hearts:

1 Like

Do you know what is needed to get only Tom’s nice prompt ?

Thx

If you have a peek at @LTS_Tom’s “bashrc” file on GitHub lines 61-65 you’ll see where it’s set at. Though some aspects of it are dependent on other factors, the bulk of it is defined there.

2 Likes

@kingsolmn thx, I almost extracted PS1, will work tomorrow to make sure it shows git branch name as well.

I think this is what it takes + git branch info in .bashrc file

function parse_git_branch {
  git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ [\1]/'
}

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]\[\033[0;31m\]\342\224\214\342\224\200\$([[ \$? != 0 ]] && echo \"[\[\033[0;31m\]\342\234\227\[\033[0;37m\]]\342\224\200\")[$(if [[ ${EUID} == 0 ]]; then echo '\[\033[01;31m\]root\[\033[01;33m\]@\[\033[01;96m\]\h'; else echo '\[\033[0;39m\]\u\[\033[01;33m\]@\[\033[01;96m\]\h'; fi)\[\033[0;31m\]]\342\224\200[\[\033[0;32m\]\w\[\033[0;31m\]]\n\[\033[0;31m\]\342\224\224\342\224\200\342\224\200\342\225\274 \[\033[0m\]\[\e[01;33m\]\\[$txtcyn\]\$(parse_git_branch)\[$txtred\]\$git_dirty\[$txtrst\] \$\[\e[0m\] "
    ;;
*)
    ;;
esac
1 Like

I just came across something of interest in this area while going through some videos (relearning Vim) from thoughtbot. It seems they have made a very interesting tool around dot files management! Before anyone asks (@LTS_Tom, @ph1L) it is open source:

Also, thoughtbot has some great videos on Vim. Here’s the video where I found this tool (it’s right at the end) with tons of cool completion stuff Vim has out of the box (almost):

1 Like