Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is registry equivalent for Linux? [closed]

Recently I have been involved in code porting from Windows to a Linux. I came across so many windows functions which retrieve registry keys and edit it. I am not sure what can be the equivalent approach for Linux. I know registry is just a windows database which stores data in "Key=value" format. I am thinking about INI file. Other than this is there anything that is more efficient?

I am not asking from a storage perspective. My question is related to registry equivalent in Linux. How can we achieve registry structure in Linux?

like image 448
sonu gupta Avatar asked Apr 24 '17 05:04

sonu gupta


People also ask

Why Linux has no registry?

There's no registry, because all the settings are in text files in /etc and in your home directory. You can edit them with any old text editor.

Does Linux use registry keys?

There is no Registry in linux. But you should take a look at gconf-editor and dconf-editor ... and also hidden files/folders inside your home directory (with names starting with dot), mostly plain (TXT) files containing some configuration for a specific program. Save this answer.

What does Linux have instead of registry?

Linux does not have a registry. This is both a blessing and a curse. The blessing is that configuration files are most often kept as a series of text files (think of the Windows . INI files before the days of the Registry).

Is there registry in Linux?

Why don't Linux operating systems have a registry like Windows? A few different things. At the system level, the /etc directory stores almost all configuration data, largely in plaintext files. There's also stuff in /var like the dpkg database on Debian based systems that records all of the installed software.


1 Answers

A typical way to store configuration in Linux per user is to store it in /home/username/.someapp, where someapp is the name of your program. I love this in Linux actually because when I move to another computer, all I have to do is save/move my home directory, and that will save all my configuration.

On Windows, the registry has a user part HKEY_CURRENT_USER, and others that represent any user, such as HKEY_LOCAL_MACHINE, being global for the whole system. For the user part, you should put the configuration in the user directory like I explained before, because it shouldn't require any super-user privileges. The local machine part you can choose either to also put in the user directory, where then every user will have separate configuration, or put it in something like /var/lib/someapp, but keep in mind that it'll be read-only then.

With all this, keep in mind that you should create your own configuration format, or use some library, such as libconfig, XML or JSON.

like image 170
The Quantum Physicist Avatar answered Oct 07 '22 13:10

The Quantum Physicist