So I did something exceedingly stupid and now my .bashrc file is gone. Is there any way for me to recover it? I still have a terminal window open that uses the old bashrc file. If there's no way for me to recover it all (as I imagine there isn't) what else should I copy to a new .bashrc besides the old $PATH? I'm on Ubuntu 12.04 if there is an OS-specific solution.

  • 1
    set can tell you a bit more than sole $PATH.
    – choroba
    Aug 7, 2013 at 15:09
  • 1
    You're probably better off asking on Unix & Linux. There's a related question there
    – user2062950
    Aug 7, 2013 at 15:10
  • 6
    the best you can do (I think) is capture the state of your open window session. export > export_list.txt; set > set_list.txt; functions > func_list.txt; alias > alias_list.txt might get you most of what was there. Any logic will have to be rebuilt. Good luck.
    – shellter
    Aug 7, 2013 at 15:11

1 Answer 1


Ubuntu uses /etc/skel/.bashrc as the base .bashrc that gets copied into every new users home directory. Unless you have made custom changes you can simply copy /etc/skel/.bashrc to your home directory and you will be set. If you have made custom changes then you will need to make them again.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.