Modifying the bashrc or bash startup files.

Find the article here.

Copy here:

If you\’ve been learning the command-line and you have the basics down (you should be, as the most effective way to use a computer is a combination of a GUI and command-line), the next step is to customize your environment.

Beginner\’s Tip: \”command-line\” and \”shell\” are often used synonymously. In unix, technically speaking, the shell is what processes the command-line, but usually, they mean the same thing

The ability to fully customize your shell is one of the most powerful things about the command-line. It\’s a dry subject, and mastering it won\’t get you favors from the opposite sex (although it should), but it can be very useful.

There are many ways to customize your shell, but the first one you should learn is modifying your Bash startup files (assuming your shell is Bash, which is the default in OS X, Linux, and many other unices).

When I first learned how to customize bash, I found an overwhelming amount of information and opinion, which made it difficult. This article is intended to give you the fundamental concepts so that you can create your own startup files, and understand how they work. To give you an example, I go through a subset of my own files, section by section.

Let\’s install the example startup files

Beginner\’s Tip: Directory and folder are synonymous. Often folder is used in Windows and OS X and directory is used in Linux, however even Linux represents a directory as a folder graphically

Below are the two example startup files: .bashrc and .bash_profile.

If you would like to use these as your startup files, follow the following directions for your OS.


  1. If you want a backup of your existing files, use the following commands (if the files don\’t already exist, you will get an error. The files will be named .bashrc_ORIGINAL and .bash_profile_ORIGINAL in your home folder):

    cp ~/.bashrc ~/.bashrc_ORIGINAL ; cp ~/.bash_profile ~/.bash_profile_ORIGINAL
  2. Copy .bash_profile and .bashrc to your home folder.
    There are a variety of ways to do this, but the simplest is to use the curl command:

    curl -o ~/.bash#1 \"{rc,_profile}\"
  3. You do not need to log out, just create a new window or tab in iTerm, or a new window in Terminal.

Linux and other unices:

  1. If you want a backup of your existing files, use the following commands (if the files don\’t already exist, you will get an error. The files will be named .bashrc_ORIGINAL and .bash_profile_ORIGINAL in your home folder):

    cp ~/.bashrc ~/.bashrc_ORIGINAL ; cp ~/.bash_profile ~/.bash_profile_ORIGINAL
  2. Copy .bash_profile and .bashrc to your home directory.
    There are a variety of ways to do this, but the simplest is to use the wget (or curl for BSD and others) commands:

    wget -O ~/.bashrc \"\"
    wget -O ~/.bash_profile \"\"


    curl -o ~/.bash#1 \"{rc,_profile}\"
  3. Log out then log back in in order to load .bash_profile. Alternatively, you can do a source ~/.bash_profile to run the files.

What the heck are bash Startup Files?

Beginner\’s Tip: ~ represents your home folder, it is short-hand notation so that you don\’t have to type the whole thing; it is also used when you don\’t know the home folder; for example, my code above works, no matter where your home folder/directory is.

Bash, as well as other unix shells, have files that run when they start. You can modify these files to set preferences, create aliases and functions (a kind of micro-script), and other such fun.

When you start an interactive shell (log into the console, open terminal/xterm/iTerm, or create a new tab in iTerm) the following files are read and run, in this order:

  1. /etc/profile
  2. /etc/bashrc
  3. ~/.bash_profile
  4. ~/.bashrc (Note: only if you call it in .bash_profile or somewhere else)

When an interactive shell, that is not a login shell, is started (when you call \”bash\” from inside a login shell, or open a new tab in Linux) the following files are read and executed, in this order:

  1. /etc/bashrc
  2. ~/.bashrc
Beginner\’s Tip: Normally you can\’t see the . files (files that start with a period) because they are hidden. Depending on your OS, you can simply turn on hidden files. Another option is to open the file in the command-line. Here are a few examples:
In shell: pico .bashrc
In shell: vi .bashrc
In OS X: open .bashrc
In GNOME: gedit .bashrc

/etc/profile and /etc/bashrc are run for all users on the system. Often on your workstation, there is only one user, you. But in systems with more than one user, these files can be used to set generic settings for all users. The files in your home folder, ~/.bashrc and ~/.bash_profile, are only for your particular user (since /etc/bashrc is run before ~/.bashrc, you can override anything in /etc/bashrc by simply setting it again in ~/.bashrc). Normally I only change these, since they are in your home folder, and only you have rights to them, you can change them without worry of affecting anyone else.

When your session starts, these files are run, just as if you typed the commands in yourself. Anything that normally works in the shell works in these files. Since .bash_profile only runs when you first login, you set very little there; the only important thing is your PATH. bashrc is where the meat goes, and will be where you spend all your time.

Comments, export, and aliases, the tools of the trade

The most common commands you use in your .bashrc and .bash_profile files are the following:

  • comments: A # starts a comment, which continues until the end of a line. The comments are not run by the system, and are only there for your information. Use them to make notes to yourself for future reference.

    For example:

    # A very interesting comment, sure to be read by everyone
    alias foo=\'bar\' # Another comment, dangling at the end of a line
  • alias: An alias is simply substituting one piece of text for another. When you run an alias, it simply replaces what you typed with what the alias is equal to.

    For example, if you create an alias called foo and set it to \”cd /etc\”:

    alias foo=\'cd /etc\'

    Beginner\’s Tip: To test your startup files, use the source command (. also works). It loads and executes a file in your current process (rather than starting a new process, which is normally what happens):
    source .bashrc

    In the command-line every time you type foo it is replaced by cd /etc. If you type foo ; ls it will be run as cd /etc ; ls.

    To see what aliases are set on your system use the alias command. If run without any parameters it will list all the aliases.

    Note: You can create a temporary alias by setting it in the command-line rather than in a bash startup file. Lets say you\’re typing the same command over and over as you\’re working on some task. Just set an alias (alias foo=ThingImDoingOverAndOver). It will only exist in your current session.

  • export: Export sets an environment variable. Various environment variables are used by the system, or other applications, such as grep, or bash itself. They simply are a way of setting parameters that any application/script can read. If you set a variable without the export command, that variable only exists for that particular process (for example if you set a variable in a script, only that script can access it). You do this like so:


    If you want that variable to be accessible by other child processes (which is a fancy way of saying by everything) then you simply use the export command to make it permanent (technically it isn\’t permanent, but if you set it in your bash startup scripts it will be available to everything you run in bash, which basically means everything.). To make FOO, which we just set, permanent, we do the following in our .bashrc file:

    export FOO=1234

    It is common to make environment variables all upper case, as shown in the example.

    Bash has a set of environment variables you can set, such as the prompts (see below). Other applications use them too, such as GREP_OPTIONS for grep (see below). You can also create your own, to be used by you in the command-line or in scripts. In the color section below I create common colors to be used in the startup files, as well in other scripts I write.

    To see what environment variables are set on your system use the set command. If run without any parameters it will list them.

    To use an environment variable, you preface it with a $. A simple way to test this (assuming you set FOO already) is to print out the value using the echo command, like so:

    echo $FOO

Creating your .bash_profile


The .bash_profile file runs when you first login. You can put everything in this file, but since it only runs once and doesn\’t run when you start a non-login session, it is best that you put only the bare minimum, and then run the .bashrc file. With this approach, your .bashrc gets run every-time to start a new session, because it is called from .bash_profile on login, and it also gets run by bash automatically when starting a non-login shell.

The first thing to setup is your PATH. A path will already be set by the system, so you don\’t want to overwrite that. You can add to the path like this:

# Add to original path	
export PATH=/foo:/foo/bar:$PATH

The $PATH at the end represents the existing path; in otherwords, you are taking the existing path, whatever that is set to, and adding the paths /foo and /foo/bar to it.

It is a good idea to add your bin directory to your path, if you have it. It\’s a standard place to add all of your scripts. The following lines will add the bin folder in your home folder to the path. The if statement simply checks to make sure it exists first before it adds it. This is safe to use even if there is no bin folder:

if [ -d ~/bin ]; then
export PATH=:~/bin:$PATH

Next, we will run the .bashrc file. The source command reads and runs another file in the same session you\’re in (the . command does the same thing and is synonymous with source).

source ~/.bashrc

If you like, you can show a welcome message. This only runs when you first log in. The following is an example welcome message (note the colors, which are set in .bashrc below):

echo -e \"Kernel Information: \" `uname -smr`
echo -e \"${COLOR_BROWN}`bash --version`\"
echo -ne \"${COLOR_GRAY}Uptime: \"; uptime
echo -ne \"${COLOR_GRAY}Server time is: \"; date

On my workstation, it displays the following:

	Last login: Wed Aug 29 09:55:37 on ttyp1<br />	Welcome to Darwin!<br />	Kernel Information:  Darwin 8.10.1 i386<br />	GNU bash, version 2.05b.0(1)-release (powerpc-apple-darwin8.0)<br />	Copyright (C) 2002 Free Software Foundation, Inc.<br />	Uptime: 10:41  up 47 mins, 3 users, load averages: 0.01 0.02 0.00<br />	Server time is: Sat Sep 29 18:41:12 PDT 2007<br /></pre>   <h2>Now the fun* begins, creating your .bashrc</h2> <p><em>* The word \"fun\" is used for entertainment purposes only. \"Fun\" or any other type of amusement is neither guaranteed nor expressly implied.</em></p>  <p>The .bashrc file is where the meat of your customization goes.</p> 	 <p>Normally it doesn\'t matter in which order various items go, so the way the file is laid out is an individual preference. There are many ways to setup a .bashrc file, and many things you can use it for, there is no \"right\" way; only opinions on which is the right way. </p> 	 <p>In this section I\'m going to go over some of the more common things you would use it for, as well as some things that are less common, but that I personally like. You can include as little or as much as you like in your own file. </p>   <h3><font color=\"blue\">C</font><font color=\"red\">o</font><font color=\"#cccc33\">l</font><font color=\"blue\">o</font><font color=\"green\">r</font><font color=\"red\">s</font><span style=\"font-size: 8px; vertical-align: top; color: darkgray;\">TM</span></h3>  <p>Colors aren\'t the most important thing, truly, however because I use colors throughout the entire file, I need them to be created first.</p>  <p>I\'ll start by turning on colors for misc things, the following set your terminal to be the color variant of xterm,  	turn on colors in <a linkindex=\"22\" href=\"\" title=\"Wikipedia Entry: Grep\">grep</a>, etc:</p>  <pre class=\"textmate-source\">export TERM=xterm-color<br /><br />export GREP_OPTIONS=\'--color=auto\' GREP_COLOR=\'1;32\'<br /><br />export CLICOLOR=1 <br /></pre>  <p>OS X and BSD - The following command turns on colors in <strong><a linkindex=\"23\" href=\"\" title=\"Wikipedia Entry: Ls\">ls</a></strong>:</p>  <pre class=\"textmate-source\">alias ls=\'ls -G\'  <br /></pre>  <p>Linux, etc - uses the following to turn on colors in ls. You can specify exactly what color is used for what, which is very nice. See <a set=\"yes\" linkindex=\"24\" href=\"\"></a> for more information on setting specific colors:</p>  <pre class=\"textmate-source\">alias ls=\'ls --color=auto\' <br />export LS_COLORS=\'di=1:fi=0:ln=31:pi=5:so=5:bd=5:cd=5:or=31:mi=0:ex=35:*.rb=90\'<br /></pre>  <p>Some standard colors, to make adding colors later in this file, or in scripts, easier:</p>  <pre class=\"textmate-source\">export COLOR_NC=\'\\e[0m\' # No Color<br />export COLOR_WHITE=\'\\e[1;37m\'<br />export COLOR_BLACK=\'\\e[0;30m\'<br />export COLOR_BLUE=\'\\e[0;34m\'<br />export COLOR_LIGHT_BLUE=\'\\e[1;34m\'<br />export COLOR_GREEN=\'\\e[0;32m\'<br />export COLOR_LIGHT_GREEN=\'\\e[1;32m\'<br />export COLOR_CYAN=\'\\e[0;36m\'<br />export COLOR_LIGHT_CYAN=\'\\e[1;36m\'<br />export COLOR_RED=\'\\e[0;31m\'<br />export COLOR_LIGHT_RED=\'\\e[1;31m\'<br />export COLOR_PURPLE=\'\\e[0;35m\'<br />export COLOR_LIGHT_PURPLE=\'\\e[1;35m\'<br />export COLOR_BROWN=\'\\e[0;33m\'<br />export COLOR_YELLOW=\'\\e[1;33m\'<br />export COLOR_GRAY=\'\\e[0;30m\'<br />export COLOR_LIGHT_GRAY=\'\\e[0;37m\'<br />alias colorslist=\"set | egrep \'COLOR_\\w*\'\"  # lists all the colors<br /></pre>  <p>Here is an example of using a color in a script (note, the -e is required):</p> <pre class=\"textmate-source\">echo -e \"The color ${COLOR_GREEN}green${COLOR_NC} is nice.\"		<br /></pre>   <h3>Prompts  ~/bin > </h3>  <div class=\"info_box\"><p><span class=\"info_box_title\">Beginner\'s Tip:</span>  	If you use different systems, a good trick is to check or import your startup files 	<em> (and any other . files you like [. or dot files are hidden files and often used for settings])</em> into a <strong>source code repository</strong>, such as subversion. Then no matter what system you are on, assuming your subversion server is accessible, you can simply \"checkout\" your files with one command. Alternatively, you can store them on your website.</p> 	 	<p>You can also do this with your ~/bin folder so you have your scripts too. It takes only a second to get them, and saves you time configuring the environment.</p> </div>  <p>In the shell, every line begins with the prompt, right before the area you can type into. You can put a variety of different things in your prompt, from simply characters such as <strong>></strong> to your user name, the name of the machine, or a ridiculous number of other things.</p>  <p>Some people\'s prompts are, frankly, silly; do you really need your prompt to say something like this (note, the answer is \"no\")?<br />	<strong>juser@myMachine 1/1/2007 12:31:02 PM - \"Funny quote of the day\" - /home/juser></strong></p>  <p>I make my prompt as simple as possible, normally all you see is <br /><strong>~ ></strong>, which is just the path of the current folder followed by a \">\".</p>  <p>Knowing what user I am logged in as and which machine I\'m on is also useful, but I put that in the window of my terminal (see below). For this very simple prompt, I use the following:</p>  <pre class=\"textmate-source\">export PS1=\"\\[${COLOR_GREEN}\\]\\w > \\[${COLOR_NC}\\]\"<br /></pre>  <p>Since you can setup a .bashrc for each user, I normally set my regular user\'s prompt to be green, and then I change it to red for <a linkindex=\"25\" href=\"\" title=\"Wikipedia Entry: Root user\">root</a>.  This gives me a visual reminder that I\'m logged in as root, and to be careful.</p>  <p>The following runs before the prompt and sets the title of the terminal window.   	If you set the window title in the prompt, weird wrapping errors occur on some systems, so this method is superior:</p>  <pre class=\"textmate-source\">export PROMPT_COMMAND=\'echo -ne \"\\033]0;${USER}@${HOSTNAME%%.*} ${PWD}\"; echo -ne \"\\007\"\' 	<br /></pre>  <p><em>Note: PROMPT_COMMAND, used in this way, causes problems when you are using the command-line directly (a non-graphical terminal, such as the system console). Simply disable this in those circumstances. You can also write a little <strong>if</strong> to check for that if you like.</em></p> 	 <p>Here is an alternative prompt, with the user and machine name:</p>  <pre class=\"textmate-source\">export PS1=\"\\[${COLOR_GRAY}\\]\\u@\\h \\[${COLOR_GREEN}\\]\\w > \\[${COLOR_NC}\\]\"  # Primary prompt with user, host, and path <br /></pre>   <p>Now I just set prompts 2 through 4. There is a lot of information on setting prompts, but to cover that would be a whole other article. I wanted to give you just the basics, if you want more in depth information follow this <a linkindex=\"26\" href=\"\">link</a>.</p>  <pre class=\"textmate-source\">export PS2=\'> \'    # Secondary prompt<br />export PS3=\'#? \'   # Prompt 3<br />export PS4=\'+\'     # Prompt 4	<br /></pre>   <h3>Navigation</h3>  <p>In the command-line, you have to move around a lot. The following aliases are designed to help you navigate your file system with ease.</p> 	 <p>Here is a very simple and useful way to move back up the directory tree, two dots moves you up one, and three dots moves you up two levels in your path:</p>  <pre class=\"textmate-source\">alias ..=\'cd ..\'<br />alias ...=\'cd .. ; cd ..\'<br /></pre>  <p>A lot of people create a <strong>home alias</strong>, but this isn\'t necessary. <strong>cd</strong> by itself, without any parameters takes you back to your home.</p>  <p>Another tip is to use <strong>cd -</strong> which takes you to the previous folder.</p>  <p>The following is very cool; I got it from this <a linkindex=\"27\" href=\"\" title=\" - Changing between directories the easy way\">site</a>.   I modified it slightly to make it work a little better:</p>  <pre class=\"textmate-source\">if [ ! -f ~/.dirs ]; then  # if doesn\'t exist, create it<br />	touch ~/.dirs<br />fi<br /><br />alias show=\'cat ~/.dirs\'<br />save (){<br />	command sed \"/!$/d\" ~/.dirs > ~/.dirs1; \\mv ~/.dirs1 ~/.dirs; echo \"$@\"=\"`pwd`\" >> ~/.dirs; source ~/.dirs ; <br />}<br />source ~/.dirs  # Initialization for the above \'save\' facility: source the .sdirs file<br />shopt -s cdable_vars # set the bash option so that no \'</pre>   <h2>All done... finally</h2>  <p>That is a lot of information, and to fully cover everything it could be ten times longer.</p> 	 <p>I hope you found something of use, I got rid of the cruft, and tried to only include truly useful things. There are tons of other things you can do to customize bash, happy bashing.</p>   </div>     <p><strong></strong></p> is required when using the above facility<br /></pre>  <p>It basically allows you to save bookmarks to folders. If you constantly go to a particular directory, you can just set it as a bookmark like so:</p> <pre class=\"textmate-source\">save foo</pre>  <p>This will set the current folder you are in as the bookmark <strong>foo</strong>.  To get back to the folder, just type this:</p> <pre class=\"textmate-source\">cd foo</pre>  <p>You can list your \"bookmarks\" with the show command:</p> <pre class=\"textmate-source\">show<br />foo=\"/Users/joebob/foo\"<br /></pre>  <p>The bookmarks are stored in the <strong>~/dirs</strong> file, so you can edit them there too if you like.</p>   <h3>Editors</h3> <p>If an application, such as Subversion, needs you to edit text. It will often launch an external editor and load the text into it. You can modify which application is launched by setting the EDITOR variable. I\'ve listed various options below depending on your system:</p>  <pre class=\"textmate-source\">#export EDITOR=\'mate -w\'  # OS-X SPECIFIC - TextMate, w is to wait for TextMate window to close<br />#export EDITOR=\'gedit\'  #Linux/gnome<br />#export EDITOR=\'vim\'  #Command line<br />export EDITOR=\'pico\'  #Command line<br /></pre>   <h3>Misc</h3>  <p>Common <a linkindex=\"28\" href=\"\" title=\"Wikipedia Entry: Ls\">ls</a> commands.  Many people use these.   	<strong>ll</strong> shows the long listing, and <strong>lla</strong> shows the long listing with hidden files:</p>  <pre class=\"textmate-source\">alias ll=\'ls -hl\'<br />alias la=\'ls -a\'<br />alias lla=\'ls -lah\'<br /></pre>  <p>Some very useful settings I like to set:</p>  <pre class=\"textmate-source\">export HISTCONTROL=ignoredups # Ignores dupes in the history<br />shopt -s checkwinsize # After each command, checks the windows size and changes lines and columns<br /><br /># bash completion settings (actually, these are readline settings)<br />bind \"set completion-ignore-case on\" # note: bind is used instead of setting these in .inputrc.  This ignores case in bash completion<br />bind \"set bell-style none\" # No bell, because it\'s damn annoying<br />bind \"set show-all-if-ambiguous On\" # this allows you to automatically show completion without double tab-ing<br /><br /># Turn on advanced bash completion if the file exists (get it here:<br />if [ -f /etc/bash_completion ]; then<br />    . /etc/bash_completion<br />fi<br /></pre>  <p>Others you may find useful:</p>  <pre class=\"textmate-source\">alias g=\'grep -i\'  #case insensitive grep<br />alias f=\'find . -iname\'<br />alias ducks=\'du -cks * | sort -rn|head -11\' # Lists the size of all the folders and files<br />alias top=\'top -o cpu\'<br />alias systail=\'tail -f /var/log/system.log\'<br /></pre>  <p>Shows the commands you use most, it\'s a cool script I got this from this <a linkindex=\"29\" href=\"\">site</a>.  It\'s useful 	to show you what you should create aliases for:</p>  <pre class=\"textmate-source\">alias profileme=\"history | awk \'{print \\$2}\' | awk \'BEGIN{FS=\"|\"}{print \\$1}\' | sort | uniq -c | sort -n | tail -n 20 | sort -nr\"<br /></pre>   <h3>Subversion and Diff</h3>  <p>This section is only useful if you use <a linkindex=\"30\" href=\"\" title=\"\">Subversion</a> and <a linkindex=\"31\" href=\"\" title=\"Wikipedia Entry: Diff\">diff</a>.  However, it highlights various things you can do with aliases and functions.</p>  <p>The basic concept is to wrap a bunch of commands, giving them a new naming convention.  In this case the command is <strong>svn</strong>, and it has many options, such as 	<strong>svn status</strong>. By wrapping these commands, you can set common parameters that you use all the time. Also since they are aliases, you can use bash completion (set above) to get a nice list of the commands. For the following, if I just type <strong>sv</strong> and tab, I get a list of commands.</p> 	 <p>Some of these aliases simply wrap the original commands, without modifying them. I do this for consistency, and it gives me the opportunity to change them later.</p>  <p>First we set some standard settings for Subversion:</p>  <pre class=\"textmate-source\">export SV_USER=\'juser\' # Change this to your username that you normally use on Subversion (only if it is different from your logged in name)<br />export SVN_EDITOR=\'${EDITOR}\'</pre>  <p>The next alias is interesting, as I\'m basically using it to provide help to myself. Of course if you know subversion well, you don\'t need this, but it may be useful when you\'re first starting out and learning. When you type <strong>svshowcommands</strong>, it prints out a nice colored description of all the commands.  Notice how 	you can have one alias on multiple lines:</p>  <pre class=\"textmate-source\">alias svshowcommands=\"echo -e \'${COLOR_BROWN}Available commands: <br />   ${COLOR_GREEN}sv<br />   ${COLOR_GREEN}sv${COLOR_NC}help<br />   ${COLOR_GREEN}sv${COLOR_NC}import    ${COLOR_GRAY}Example: import ~/projects/my_local_folder<br />   ${COLOR_GREEN}sv${COLOR_NC}checkout  ${COLOR_GRAY}Example: svcheckout<br />   ${COLOR_GREEN}sv${COLOR_NC}status    <br />   ${COLOR_GREEN}sv${COLOR_NC}status${COLOR_GREEN}on${COLOR_NC}server<br />   ${COLOR_GREEN}sv${COLOR_NC}add       ${COLOR_GRAY}Example: svadd your_file<br />   ${COLOR_GREEN}sv${COLOR_NC}add${COLOR_GREEN}all${COLOR_NC}    ${COLOR_GRAY}Note: adds all files not in repository [recursively]<br />   ${COLOR_GREEN}sv${COLOR_NC}delete    ${COLOR_GRAY}Example: svdelete your_file<br />   ${COLOR_GREEN}sv${COLOR_NC}diff      ${COLOR_GRAY}Example: svdiff your_file<br />   ${COLOR_GREEN}sv${COLOR_NC}commit    ${COLOR_GRAY}Example: svcommit<br />   ${COLOR_GREEN}sv${COLOR_NC}update    ${COLOR_GRAY}Example: svupdate<br />   ${COLOR_GREEN}sv${COLOR_NC}get${COLOR_GREEN}info${COLOR_NC}   ${COLOR_GRAY}Example: svgetinfo your_file<br />   ${COLOR_GREEN}sv${COLOR_NC}blame     ${COLOR_GRAY}Example: svblame your_file<br />\'\"</pre>  <p>Here I wrap each command:</p>  <pre class=\"textmate-source\">alias sv=\'svn --username ${SV_USER}\'<br />alias svimport=\'sv import\'<br />alias svcheckout=\'sv checkout\'<br />alias svstatus=\'sv status\'<br />alias svupdate=\'sv update\'<br />alias svstatusonserver=\'sv status --show-updates\' # Show status here and on the server<br />alias svcommit=\'sv commit\'<br />alias svadd=\'svn add\'<br />alias svaddall=\'svn status | grep \"^\\?\" | awk \"{print \\$2}\" | xargs svn add\'<br />alias svdelete=\'sv delete\'<br />alias svhelp=\'svn help\' <br />alias svblame=\'sv blame\'<br />alias svdiff=\'sv diff\'<br /></pre>  <p>You may have noticed I added a few commands too, such as <strong>svaddall</strong>; this isn\'t part of standard Subversion.  This command, for example, adds 	all files that aren\'t already in the repository.</p> 	 <p><strong>OS X specific:</strong> The following alias allows you to use the  	<a set=\"yes\" linkindex=\"32\" href=\"\" title=\"Wikipedia Entry: Apple Developer Tools\">FileMerge</a> OS X app for your diffs.   	You need to create fmdiff and fmresolve, which can be found at this <a linkindex=\"33\" href=\"\">site</a>.</p>  <p><em>Note: Use diff for command line diff, use fmdiff for gui diff, and svdiff for subversion diff.</em></p> 	 <pre class=\"textmate-source\">alias svdiff=\'sv diff --diff-cmd fmdiff\' # OS-X SPECIFIC</pre>   <h4>Functions</h4>  <p>Functions deserve their own article. But basically they are used when an alias isn\'t enough. The following is a simple example of a function, it is used to show the both the info and the log of a file in subversion in one command (<strong>svgetinfo</strong>):</p>  <pre class=\"textmate-source\">svgetinfo (){<br />    sv info $@<br />    sv log $@<br />}	<br />

All done… finally

That is a lot of information, and to fully cover everything it could be ten times longer.

I hope you found something of use, I got rid of the cruft, and tried to only include truly useful things. There are tons of other things you can do to customize bash, happy bashing.

Technorati Tags: bash, bashrc, bash_history, bash_profile, prompt

4 thoughts on “Modifying the bashrc or bash startup files.”

  1. I just wanted to comment your blog and say that I really enjoyed reading your blog post here. It was very informative and I also digg the way you write! Keep it up and I’ll be back to read more in the future…

This site uses Akismet to reduce spam. Learn how your comment data is processed.