JonMorehouse
JonMorehouse

Reputation: 1383

Retrieve loaded bash profile after ~/.bash_profile deleted

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?

Upvotes: 6

Views: 1263

Answers (3)

ephemient
ephemient

Reputation: 205014

declare

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

Upvotes: 5

yingted
yingted

Reputation: 10554

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.

Upvotes: 5

paxdiablo
paxdiablo

Reputation: 882646

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

env >template_bash_profile

And then work from that.

Upvotes: 3

Related Questions