How do I restore original configuration file that's in the home directory?

1

I'm asking in general but also because I'd like to know how to restore a configuration file of the Transmission bittorrent client (apt package is named transmission-gtk). I'm on Ubuntu 13.10, and it placed a config file in ~/.config/transmission/settings.json. How do I get back the original file?

I tried deleting the file and doing a 'sudo apt-get install --reinstall transmission-gtk', and some variations of this. That didn't work, so I tried doing it with transmission-common, which transmission-gtk depends on. Also didn't work.

I tried doing 'apt-file list transmission | grep settings.json' to find out which transmission package, if any, created this file, but nothing appeared. I thought if an apt package places a configuration file somewhere it would appear in this list. But it doesn't.

How can I get back the original config file without having to do a complete uninstall and reinstall of the software. I imagine there's some reasonable way to get at that file?

user779159

Posted 2014-01-15T18:48:14.323

Reputation: 249

Answers

2

In most cases, the program will check if its default configuration file exists and will create it if it doesn't. So, usually, to get the original file back, all you need to do is start the application.

In the specific case of transmission, the settings.json is created as soon as you modify any setting in the preferences. All you need to do is rename the file you have:

mv ~/.config/transmission/settings.json ~/.config/transmission/settings.json.bak 

Then launch transmission-gtk and change any setting to create a new one.

terdon

Posted 2014-01-15T18:48:14.323

Reputation: 45 216

4

Most packages do not put configuration files in users' home directories - after all, apt-get install is run as root; how would it know whom to give the configuration file to?

The application itself generally writes a configuration when it is run the first time and finds none. Most often, one can find example templates in /usr/share/packagename for reference.

DopeGhoti

Posted 2014-01-15T18:48:14.323

Reputation: 543