Is .profile or .bashrc backed up anywhere automatically? There are hidden files that are fairly important if you use terminal a lot at ~/.profile and ~/.bashrc, etc. Are these files backed up anywhere by default? sometimes I append to environment variables to .profile via command line, e.g. echo 'export foo=bar' &gt;&gt; ~.profile and realized that I could be in big trouble if I accidentally left out one of the &gt; characters.
No, there is no special handling of .profile, .bashrc or any other config file within OS X. So unless you are running a regular backup (e.g. using Time Machine), these files will be lost if you type &gt; instead of &gt;&gt;.

Some of-the-top-of-the-head ideas to overcome this


run a regular backup (there are probably files on your computer which are more important than .profile so you should be doing this anyway)
change habits and use the text editor of your choice to update shell profiles
create a shell function to do the append operation, e.g. something like this (untested)

add_to_profile() {
    echo &gt;&gt; ~/.profile
    echo '# ' Added on $(date) &gt;&gt; ~/.profile
    echo $* &gt;&gt; ~/.profile
}


and use it like add_to_profile 'export foo=bar'.
use Hazel (or Folder Actions) to backup .profile and .bashrc automatically after each change
put those files under version control (either locally or on Github)