17

As mentioned, what is the difference? or is there any concern to use them?

A-letubby
  • 709
  • 2
  • 6
  • 6

2 Answers2

19

Unlike DOS-based OSes, in Unix and Linux file extensions are mostly meaningless outside of human-readable reasons. INI is a configuration file standard.

A .conf file could be an INI file, or it could be any other configuration system that the application supports. MySQL, for example, uses the file my.cnf by default for configuration, which is an INI file.

jordanm
  • 42,678
  • 3
    Are .ini files carry overs from Windows coders? – Rob Nov 06 '12 at 14:19
  • @Rob Kindof, but not really. It is like many programs will use an extension that defines the format (openbox's .xml config for example). There isn't really a solid convention. Personally I put the filetype as an extension if I use one (which I usually don't). – Kevin Cox Nov 06 '12 at 20:15
7

INI-style configuration files may have a format similar to this:

[heading1]
key1=value
key2=value

[heading2] a=1 b=2

etc...

conf-style configuration files are more varied. They may look similar to this:

# A comment
button 1 {
  name "hello"
  "text" hi.there
  "more..." {
    "something 123"  bla.bla "123"
  }
}

Another comment

button 2 {

hello

x=2 }

Or perhaps a bit like this:

# set server port
server.port = 1234

make everything go faster

machine.turbo_button = activated

On Mac, Linux and BSD, configuration files of all styles usually have UNIX-style line endings, while it may be a bit more varied on Windows. .ini files on Windows usually have DOS/Windows-style line endings.

Alexander
  • 9,850
  • There is nothing about the INI standard that says that ini files need DOS line endings. My php.ini file doesn't have them. – jordanm Nov 06 '12 at 18:14
  • 4
    do you have an example of such a UNIX application that expects its line endings to be DOS-style? – jordanm Nov 06 '12 at 19:59
  • This is pretty much my understanding, too. – Rob Nov 06 '12 at 20:42
  • Btw, dos line endings are \r\n, 0xD 0xA (decimal 13 and 10, not hex). – Kevin Nov 07 '12 at 13:26
  • 4
    and the line endings have nothing to do with the file format, it's just a normal text file with the usual system line endings. Most INI files use dos line endings because most INI files are on windows machines. – Kevin Nov 07 '12 at 13:31
  • @jordanm Check out man mke2fs.conf. This is the configuration file for mke2fs which creates ext2/ext3/ext4 filesystem, located at /etc/mke2fs.conf on my machine with a INI-style formatting. – btwiuse Dec 10 '16 at 06:30
  • @jordanm Yes, if you have Steam installed, several of the games may have ini-files with CRLF endings, like ie. .config/deadbolt_game/prefs.ini. Also, Google Cloud SDK comes with pyparsing which includes karthik.ini with CRLF. These exists on my system, but they are arguably not needed by "real" UNIX applications. – Alexander Aug 22 '22 at 15:44
  • @Alexander those are applications that didn't exist on *nix in 2012 when I made that comment and the original version of this answer was a little different. I believe I was being pedantic about the term "usually" originally used. – jordanm Aug 22 '22 at 18:36