DataGrip 2020.2 Help

Open files from the command line

Open an arbitrary file or folder in DataGrip from the command line, optionally specifying where to put the caret after opening.

You can find the script for running DataGrip in the installation directory under bin. To use this script as the command-line launcher, add it to your system PATH as described in Command-line interface.

Syntax
datagrip.bat [--line <number>] [--column <number>] <path ...>
Examples

Open a folder:

datagrip.bat C:\MyProject

Open a specific file on line number 42:

datagrip.bat --line 42 C:\MyProject\scripts\query.sql

By default, DataGrip does not provide a command-line launcher. For information about creating a launcher script for DataGrip, see Command-line interface.

Syntax
datagrip --line <number> <path>
Examples

Open a folder:

datagrip ~/MyProject

Open a specific file on line number 42:

datagrip --line 42 ~/MyProject/scripts/query.sql

You can find the script for running DataGrip in the installation directory under bin. To use this script as the command-line launcher, add it to your system PATH as described in Command-line interface.

Syntax
datagrip.sh --line <number> <path>
Examples

Open a folder:

datagrip.sh ~/MyProject

Open a specific file on line number 42:

datagrip.sh --line 42 ~/MyProject/scripts/query.sql

When you specify the path to a file, DataGrip opens it in LightEdit mode, unless it belongs to a project that is already open or there is special logic to automatically open or create a project (for example, in case of Maven or Gradle files). If you specify a directory with an existing project, DataGrip opens this project. If you open a directory that is not a part of a project, DataGrip adds the .idea directory to it, making it a project.

Last modified: 08 May 2020