6

I was working with a program and it deleted my .bash_profile, which I unfortunately haven't backed up for several months. I however, have one terminal open that I am not going to close which has the file loaded in.

Is there any possible way I can "export" the loaded bash aliases etc from the current terminal?

3 Answers 3

5
alias > my_aliases

can give you some aliases back, but if you have hundreds, you probably want to use comm(1) to identify which ones are in another file.

5
declare

will dump out all variables and functions in your current shell. (So will set.)

3

You can get at least some of it with the env command:

env >template_bash_profile

And then work from that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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