how to reset a program to its default state?
in android we can clear application data to reset the application to its default state. does it is possible to reset a program in ubuntu to its default state without uninstalling and reinstalling.
Application settings are usually stored either:
.) folder in
Furthermore, applications can have one or more settings in the
dconf database (gsettings). A simple way to find out if that is the case is to run in a terminal window:
dconf watch /
...and play with the settings.
Lastly, (mostly) locally installed applications possibly created a local
.desktop file. If so, you also need to delete that one to make sure you are starting from scratch.
Th bottom line is to remove these folders, if they exist, and reset the
dconf values. If you'd like a GUI way to reset thos keys, you can look them up in
dconf-editor, and reset them to default.
Local settings folder(s) will be re- created on the next time you run the application.
dconf-editor is not installed by default. To install:
sudo apt install dconf-editor
Yes, you can. The method would depend on the particular application. You would have to find the configuration folder for that particular application and rename or delete it.
Many programs use use
~/.config/[app name]. For others, you would have to check with the particular application, or developers to get the folder name.
Some examples for instance:
Thunderbird: ~/.thunderbird Google Chrome ~/.config/ Gedit ~/.config/dconf/usr (This is configured via gsettings) Wine ~/.wine ssh ~/.ssh
It depends on the type of application and how it handles multiple users. In case of multiple users, there may be one "master" config file, which then gets copied to each user's directory. In certain cases, such as when a user makes a boo-boo or there's a security concern, it's easier to just reinstall the app or the whole OS; sometimes you might just want to try emulate factory reset.
Command-line applications often keep config in
/etc/. Notable examples of that are
/etc/bash.bashrc. There may also exist extra folders (often ending with a d letter to signify daemons) for particular settings, for example
/etc/logrotate.d. Graphical applications often (but not necessarily) use dconf database. Between command-line apps and GUI apps, they may use local files. These may be stored in
~/.conf or just in plain sight in user's home folder.
The appropriate "reset" way depends on the app. Some apps have a button for that, others - may require deleting a config file. In case of GUI apps, one could use
dconf or preferably
gsettings command with
reset for particular setting or
reset-recursively for a range of setitngs. You may need to read documentation on those. And there are graphical front ends for that as Jacob Vlijm mentioned in his answer.
As for the case when you can't find what file an app uses, you can look under the hood of an app's behavior; one way is to look at
open syscalls in via
strace command. For example:
strace -e open firefox
Again, refer to
strace's manual for a set of advanced features and options that can help investigating app's behavior and open files.