Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Configuration file

From Wikipedia, the free encyclopedia
File holding settings for a computer program
"rc file" redirects here. For resource scripts, seeResource (Windows).

Aconfiguration file, also known asconfig file, is afile that storesdata used to configure asoftware system such as anapplication, aserver or anoperating system.

Some applications provide a tool to create, modify, and verify thesyntax of their configuration files – sometimes viagraphical user interface (GUI). For context,system administrators may be expected to create and modifytext config files via a text editor. For server processes and operating-system settings, there is often no standard tool, but operating systems may provide graphical interfaces such asYaST or debconf.

Some computer programs only read their configuration files atstartup. Others periodically check the configuration files for changes. Users can instruct some programs to re-read the configuration files and apply the changes to the current process, or indeed to read arbitrary files as a configuration file. There are no definitive standards or strong conventions.

File format

[edit]

In general, a config file can have anyformat. The format that applies to a particular system is determined by the design of that system. Often, a standardized format is used since it allows for using tools designed for the format even if not designed for the consuming system. In particular, general-purposeserialization formats, such asJSON,XML, andYAML, are often used inopen-source andplatform-neutral software. Thespecification for these formats are generally publicly available to support wide-spread use.

The following table compares notable formats used for configuration data.

Format comparison[1]
FormatFormal
spec
Allows
comments
Syntax
typing
CUE[2]YesYesYes
ININoYesNo
JSONYes[3]NoYes
TOMLYes[4]YesYes
UCLNo[5]YesYes
YAMLYes[6]YesYes
XMLYes[7]YesNo

Thesyntax typing column indicates whether thesyntax supportsdata types. A format has syntax-typing if a value's type is specified by syntax – e.g.true is aBoolean while"true" is astring. A format does not have syntax-typing if a value's type is based onsemantics – e.g.true and"true" are both Boolean if the parser expects a Boolean. Opinions on the value of syntax-typingvary.

Examples

[edit]

The following are examples of config files organized by theoperating systems on which they are commonly used.

Unix and Unix-like

[edit]

Many different file formats are used onUnix andUnix-like operating systems. Even so, there is a strong tradition of using human-editable, plain text formats including simplekey–value pair. Filename extensions of.cnf,.conf,.cfg,.cf or.ini are often used.

Many formats allowcomments, in which case, individual settings can be disabled byprepending with the comment character. Often the default configuration files contain extensive internal documentation in the form of comments[8][9] andman files are also typically used to document the format and options available.

System-wide software often uses configuration files stored in/etc, while user applications often use a "dotfile" – a file or directory in the home directory prefixed with aperiod, whichin Unix hides the file or directory from casual listing. Since this causes pollution, newer user applications generally make their own folder in the.config directory, a standardized subdirectory of the home directory.

Similar to config files, arun command (rc)shell script can configure ashell session. Often, such scripts are named with anrc suffix after the consuming program's name such as.xinitrc,.vimrc,.bashrc,xsane.rc.[10]

By contrast,IBM'sAIX uses anObject Data Manager (ODM) database to store much of its system settings.

MS-DOS

[edit]

MS-DOS primarily relied on theCONFIG.SYS config file, a plain text file with simple key–value pairs (e.g.DEVICEHIGH=C:\DOS\ANSI.SYS). MS-DOS 6 introduced the INI-file format. Similar to an rc file, thebatch file namedAUTOEXEC.BAT ran commands onstartup. Both these files were retained up toWindows 98SE, which still ran on top of MS-DOS.

An example CONFIG.SYS:

DOS=HIGH,UMBDEVICE=C:\DOS\HIMEM.SYSDEVICE=C:\DOS\EMM386.EXE RAMDEVICEHIGH=C:\DOS\ANSI.SYSFILES=30SHELL=C:\DOS\COMMAND.COM C:\DOS /E:512 /P

DOS applications used a wide variety of individual configuration files, most of them binary, proprietary and undocumented - and there were no common conventions or formats.[citation needed]

Windows

[edit]
The REGEDIT application being used to edit Windows Registry data

EarlyWindows operating systems heavily utilized plain-textINI files which served as the primary mechanism to configure the operating system and applications.[11] TheAPIs to read and write from these still exist in Windows, but after 1993, Microsoft began to steer developers away from using INI files and toward storing settings in theregistry, a hierarchical database to store configuration settings, which was introduced withWindows NT. Later systems use XML and other formats instead of the registry.

macOS

[edit]

TheProperty List is the standard configuration file format inmacOS (as well as iniOS,NeXTSTEP,GNUstep andCocoa applications). It uses thefilename extension.plist.

IBM OS/2

[edit]

IBM'sOS/2 uses a binary format, also with a .INI suffix, but this differs from the Windows versions. It contains alist of lists of untyped key–value pairs.[12]Two files control system-wide settings: OS2.INI and OS2SYS.INI. Application developers can choose whether to use them or to create a specific file for their applications.

HarmonyOS and OpenHarmony operating systems

[edit]

HarmonyOS andOpenHarmony-based operating systems use JSON config files, namedconfig.json. The platformIDE,DevEco Studio, provides methods for editingconfig.json.[13]

See also

[edit]
  • .properties, file extension for config file mainly used inJava
  • HOCON, a superset of .properties and JSON
  • Run commands, historical origin of the "rc" suffix for startup scripts

References

[edit]
  1. ^TOML, TOML, 2023-01-15, retrieved2023-01-15
  2. ^"About | CUE". RetrievedOctober 6, 2022.
  3. ^"The JavaScript Object Notation (JSON) Data Interchange Format".
  4. ^"TOML Specification".
  5. ^"Formal UCL grammar definition · Issue #231 · vstakhov/libucl".GitHub.
  6. ^"YAML™ Specification Index".
  7. ^"Extensible Markup Language (XML) 1.0 (Fifth Edition)".
  8. ^https://opensource.apple.com/source/postfix/postfix-174.2/Postfix.Config/main.cf.default.Archived 2017-08-03 at theWayback Machine
  9. ^http://opensource.apple.com/source/apache/apache-769/httpd.conf.Archived 2020-08-01 at theWayback Machine
  10. ^"rc file". Catb.org. Retrieved2012-02-29.
  11. ^Microsoft: Windows NT Workstation Resource Kit.
  12. ^The OS/2 INI Files by James J. Weinkam.
  13. ^Evans, Melissa."HarmonyOS (Hongmeng) — config.json".Mo4Tech. Mo4Tech. Retrieved24 March 2024.
Retrieved from "https://en.wikipedia.org/w/index.php?title=Configuration_file&oldid=1328452598"
Category:
Hidden categories:

[8]ページ先頭

©2009-2026 Movatter.jp