Usually when I find a command I want to alias, I echo it to my .bashrc like so:
[up button pressed to last command, then line edited so that it reads]
$echo "command-i-just-did" >> ~/.bashrc
There may be a better way to do this. But anyway, just now I overwrote the entire .rc file by using a single chevron. However, since the .bashrc is still current, it's still accepting my old aliases (for now of course). So is there a way to recover it?
echo "set -o noclobber" > ~/.bashrc
(remember to add a second angle bracket).bashrc
had any logic in it that depended on local variables like host, user, etc. that is probably unrecoverable. The real answer is to restore from your most recent backup. You do have a recent backup right?