Lost my .bash_profile. Is it possible to recover it from Time Machine backups? I recently completely reinstalled macOS on my MacBook but I forgot to save my personalised .bash_profile. I was stupid enough not to dump it on Gist for future use, and now I'm looking into restoring it. I have several Time Machine backups on an external SSD-drive, would it be possible to restore this file somehow, and if so, where can I find this file so I can copy it over to my current macOS installation?

Searching through the entire backup folder didn't show me any useful results. I have gone through several threads to try to locate where this file might be saved, but as of now I couldn't come across a good answer which covers my problem. Thanks!
You do not even need to enter Time Machine, although your Time Machine drive must be connected and mounted.

In Terminal, which by default opens to your $HOME directory, you can use the following command, literally, to copy the .bash_profile file to your $HOME directory:

cp -av /Volumes/*/Backups.backupdb/*/Latest/*/Users/$USER/.bash_profile .


Note that this command assumes there is only one volume attached that has a Backups.backupdb directory in its root directory.