Differences on swi-prolog command line options -f, -F, -l, -s

To be sure on using command line swipl, I asked help by
swipl --help., which includes following lines:

    -f file                  User initialisation file
    -F file                  Site initialisation file
    -l file                  Script source file
    -s file                  Script source file

Unfortunately, I am not clear on basic notions initialization,
for example. Is there clear descriptions that are enough
to makes their differences. As usual Prolog source codes includes both clauses and directives ( :- goal), these four options look same to each others. I appreciate any pointer on this. Thank you in advance.

They all load a Prolog file. They differ in when the file is loaded and how it is found. Well, -l and -s are the same, where -l was later added for compatibility. Note that these days the standard syntax is

 swipl <prolog options> file1.pl file2.pl ... <application arguments>
  • -f file is searched in the default application config directory. That is system dependent. On most non-Windows systems that is ~/.config/swi-prolog/ and the default name is init.pl. If you give an absolute path, it will use that.
  • ‘-F’ is search in the “home” directory of SWI-Prolog based on the name of the executable. I.e. swipl[.exe] looks for swipl.rc, swipl-win[.exe] looks for swipl-win.rc. There you see the reason: swipl-win[.exe] must load some additional stuff to manage the GUI console.
  • -l and -s are not searched, i.e., they must be a name of an existing file.

The system first loads the -F file (if its exists), then the -f file (if it exists) and then the -l/-s files (it is an error if they do not exist).

Thank you very much for clear explanation on swipl command line options, which answers my long held question on the command line. Now, the swipl command line options seems suddenly has appeared well-thought designed one to (also) me.