Simple .bashrc and custom prompt

After I installed Slackware 11.0 on my desktop as a virtual OS, I saw that there wasn’t any default .bashrc file under my home directory. I just needed basic things like a custom prompt, colorful ls list and some aliases. Copy the following to your .bashrc under /home/yourusername:

# Add bin to path
export PATH="$PATH:$HOME/bin"
# Dynamic resizing
shopt -s checkwinsize
# Custom prompt
PS1='\[33[01;32m\]\u@\h\[33[00m\]:\[33[01;34m\]\w\[33[00m\]\$ '
# Add color
eval `dircolors -b`
# User defined aliases
alias cls='clear'
alias clls='clear; ls'
alias ll='ls -l'
alias lsa='ls -A'
alias lsg='ls | grep'
alias vi='vim'

I changed my Suse’s prompt also to have red prompt and green font color. On Suse for the root’s prompt, you need to edit /etc/skel/.bashrc file. I think this is the default .bashrc file on a system but the location may differ for other distros. If you don’t have a .bashrc it reads from this location. For user and root prompt I am using the following:

PS1='\[33[01;35m\][\u@\h \W]\$\[33[00m\] ' #for root
PS1='\[33[01;38m\][\u@\h \W]\[33[00m\]\$ ' #for user

Different prompt color distinguishes it from the rest of the text. It increases efficiency when you are working on console.


2 Responses to “Simple .bashrc and custom prompt”

  1. Quickly color your prompt in Ubuntu 9.10 « Linux Experiences Says:

    […] prompt in Ubuntu 9.10 By parsek I found this while trying to color my bash prompt by using my old post. It was simpler than I thought. Just open your .bashrc file. Type this in a […]

  2. Larue Says:

    Attractive section of content. I just stumbled upon your
    blog and in accession capital to assert that I acquire in fact enjoyed account your blog posts.
    Any way I will be subscribing to your augment and even
    I achievement you access consistently quickly.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: