This question already has an answer here:

I have a bit of a situation. One of my co-workers just overwrote everyone's bashrc and bash_profile files. My custom settings have been lost. However, I still have a terminal open which sourced my own bash settings, before they got overwritten. Is there any way to extract the commands that got sourced at startup from an existing terminal? Thank you.

marked as duplicate by don_crissti, cuonglm, Ramesh, jimmij, slm Jul 28 '15 at 21:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You can for sure restore all aliases, variables, options and functions separately, but I don't see possibility to restore .bashrc as a whole file. – jimmij Jul 28 '15 at 15:56

You can try any of the following

    typeset -f

or if you are using Bash 4 look at the builtin compgen

  • Turns out that my IT department created snapshots of out home directories, so no losses were suffered. Nonetheless, thank you. – IDDQD Jul 28 '15 at 17:16

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