Fortran Wiki
Command-line arguments

Fortran 95 and earlier had no standard support for obtaining command-line arguments. However, with Fortran 2003, several new standard procedures were added to help parse command-line arguments: get_command_argument, get_command, and command_argument_count.


  • krackenis an open-source library for parsing Unix-like command-line arguments. It is now provide in Github as an General-Purpose-Fortran library (GPF) with a lot more functions than CLI option parsing.

  • M_CLI use a command prototype to define and read command-line arguments and leverages NAMELIST so no type conversion from strings is required

  • M_CLI2 use a command prototype to define and read command-line arguments including support of response files for abbreviating command calls with many options

  • f2kcli is an implementation of the Fortran 2003 command line interface for compilers which do not support Fortran 2003.

  • getopt_long_module by Joe Krahn.

  • getopt.f90 by Mark Gates is no longer available under But Hani Andreas Ibrahim forked the module and provides an extended version in GitHub. It parses GNU- and POSIX-style CLI-options with and without arguments. Just one module and can be learned in minutes. Wiki, sample program provided.

  • module options

  • CLAF90 is a f90-module for parsing command line arguments.~ Not available anymore.

  • CLAF90 –alternate source

  • FLAP a Fortran command Line Arguments Parser for poor people. A KISS pure Fortran Library for building powerful, easy-to-use, elegant command line interfaces.