As someone who earns part of my living by trying out Linux distros, I reinstall a LOT. Even my favorites rarely last longer than a few months before they’re wiped away to make room for something new. Invariably, one of the very first things I do after any installation is to tweak my shell to include a few options, aliases, and of course my preferred prompt. After rebuilding my .bashrc file dozens of times, I began to think there had to be a better way. I began looking for a place online to store my .bashrc file, with all my settings exactly the way I want them. This proved more difficult than I had expected. To do this properly, I needed a website that was free, did not require registration, would hold my file permanently, allow unlimited public downloads, give it an URL I could remember, and allow me to make changes to the file without having to re-upload. This was a tall order, but Pastebin.com fit the bill.
For those who’ve never used pastebin, it’s a very simple service. You enter in some text, and the website saves it to its own location. That’s it. You, or anyone else who has that URL, can view the text. It’s meant to be used by programmers and such to share things like code snippets and log messages. Fortunately, it lets you choose how long your text will remain on the server. If we save our .bashrc here, we can always return to it later to get what we need. You can choose, when saving your file, how long to keep the files stored on Pastebin.com.
If you stop here and just go the normal route, your file will be given an URL like http://pastebin.com/d535effd9. That’s not so easy to remember, so we go one step further and use…
A clever feature to Pastebin.com is that it allows you to create your own personal subdomain on the fly. For example, instead of going to just http://pastebin.com, you use your name as a subdomain (ie http://joshprice.pastebin.com) you’ll get your own little section to leave your text. Now, the word “private” is quotes here because there’s nothing keeping anyone else from accessing that same “private” area. In fact, if you have a common name and you try the method I suggested, you may find that someone else is already placing files there. Keep toying around until you can find something unique.
As you can see, the title now shows that we’re in my own private pastebin. Once again, there is nothing stopping anyone else from accessing that location and adding/changing files, it’s just a name space you can use to access things you’ve saved.
You may notice that the “Recent Posts” section in the top-left now shows only the posts in this private space. I can go back here in a year and see all the notes I’ve saved so far (presuming I told them to live that long, and no one else has changed them).
Saving Your .bashrc
Fill up your .bashrc (or whatever else you’d like to save on pastebin) with the settings you want. If you haven’t already, create a unique private space as described in the previous section. Paste in the contents of your file, choose how long you’d like to to stay on the server, and hit Send. You’ll be taken to the URL of your text file, which you can save or send to others.
Retrieving Your .bashrc
There are a few ways you could go about putting your file back on your system once the install is complete.
Simplest – Open your private pastebin address and the post you’re looking for. Highlight all the text, open your exising .bashrc file and add the pastebin info to the end.
Command Line – From your browser, open your private pastebin address and the post you’re looking for. You’ll see a Download button in the header bar above your post. Right-click the link and choose “Copy Link Location” (or your browser’s equivalent). From the command line, enter
to save the file from pastebin directly into the local .bashrc file, overwriting the existing contents. If you’re able to remember the URL of your file so you don’t have to open the website, this may be the fastest method, and it wouldn’t require a browser at all.
Recommended – Open your private pastebin address and the post you’re looking for. You’ll see a Download button in the header bar above your post. Instead of 826492.txt or whatever filename it gives you, save it in your home as something like bashrc-custom. You can add the line
to the existing .bashrc file, so that you get all the shell options the distro included as well as your customizations.