Sunday, September 18, 2011

Custom BASH Prompt in Ubuntu 11.04

Here's a quick tip for anyone who would like to customize their BASH prompt in Terminal. First, open a Terminal session, and list the contents of your home directory, making sure to include the
'-a' option to see hidden files:

    user@hostname:~$ ls -alh

You should see a file named .bashrc. This is your BASH configuration file. Open the file using gedit:

    user@hostname:~$ gedit .bashrc

Note: If, after running 'ls -alh', you don't see a .bashrc file in the results, don't worry! You can still type 'gedit .bashrc' (without the quotes) and it will create a blank .bashrc file in which you can paste the code seen below.

Once open in gedit, scroll down to around line 39, where you should see '#force_color_prompt=yes' without the quotes. Delete the '#', thus uncommenting the line and activating it.

Next, scroll down to around line 50, where you should see a section that looks similar to this:

if [ "$color_prompt" = yes ]; then  
     # PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '  
     PS1='${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\t\[\033[01;31m\] \d\n\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
     PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
unset color_prompt force_color_prompt 
     **The default bash prompt is commented out at the beginning**

As I have noted in italics above, the default BASH prompt is commented out at the beginning, just under the 'if' statement. My own custom BASH prompt is the line below that begins with 'PS1='. You can ignore the second 'PS1=', as long as you uncommented the line I mentioned above. Feel free to copy my BASH prompt and use it, if you wish. If you'd like to construct your own, I recommend taking a look at this article from IBM for reference on the various BASH prompt variables available:

That's it! Happy customizing and please feel free to share a screenshot of your custom prompt in the comments below. 

Tuesday, September 6, 2011

Who's that!?

After over half-a-year of inactivity, I have once again reactivated this blog. Back toward the first of the year I was blessed with an opportunity of a lifetime in the form of a job as a graphic designer and web developer at a local, non-profit organization. Score!

Because I am the first ever graphic designer at this organization, I have been insanely busy getting graphics of all shapes and sizes up to speed here, in addition to getting my elbows greasy under the hood of the Moodle Course Management System. The main focus has been to launch an awesome new online school and it has been a fun, arduous, and educational journey but, by God's grace, the school launches in just a few short weeks!

Anyway, I'm ready to get back in the groove here with Socketbrain! My first order of business is two-fold: to build a strong branding and begin offering valuable and insightful content and articles. I may expand on that further in a future post, but the bottom line is that I will strive to update this blog with at least two new posts per week initially, and grow from there.

I'm excited about some of the ideas I have for this blog, as well as the direction in which I wish to go with it, and hope to get many of you involved!

If you're interested in contributing to the blog, please feel free to email me: kenreynolds78-at-gmail-dot-com.