IntelliJ IDEA 2018.1 Help

Opening Files from Command Line

You can open a file for editing in IntelliJ IDEA from the command line, with the caret positioned at the specified code line.

  • In the command line, run the following command:
    <IntelliJ IDEA> path1 --line <number> path2

The command options are as follows:

Option Description
<IntelliJ IDEA> The platform-dependent IntelliJ IDEA launcher.

On macOS and Linux, it is recommended to use the command line launcher created during the IntelliJ IDEA installation, or create one manually by selecting Tools | Create Command-line Launcher on the IntelliJ IDEA main menu. Refer to Working with IntelliJ IDEA Features from Command Line for details.

path1 The path to the project that contains the desired file.
--line <number> The number of the line, where the caret should rest.
path2 The path to the file to be opened.


<IDE_HOME>\bin\idea.exe path1 --line <number> path2
<IDE_HOME>\bin\idea.exe C:\MyProject\ --line 3 C:\MyProject\scripts\numbers.js
IntelliJ\ path1 --line <number> path2
IntelliJ\ ~/MyProject/ --line 3 ~/MyProject/scripts/numbers.js
<IDE_HOME>/bin/ path1 --line <number> path2
<IDE_HOME>/bin/ ~/MyProject/ --line 3 ~/MyProject/scripts/numbers.js
Last modified: 4 April 2018