Open an arbitrary file or folder in IntelliJ IDEA from the command line, optionally specifying where to place the caret after opening.
Windows
macOS
Linux
You can find the executable for running IntelliJ IDEA in the installation directory under bin. To use this executable as the command-line launcher, add it to your system PATH as described in Command-line interface.
By default, IntelliJ IDEA does not provide a command-line launcher. For more information about creating a launcher script for IntelliJ IDEA, refer to Command-line interface.
Syntax
idea --line <number> <path>
Examples
Open a project:
$
idea ~/MyProject
Open a specific file on line number 42:
$
idea --line 42 ~/MyProject/scripts/numbers.js
You can find the script for running IntelliJ IDEA 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
idea.sh --line <number> <path>
Examples
Open a project:
$
idea.sh ~/MyProject
Open a specific file on line number 42:
$
idea.sh --line 42 ~/MyProject/scripts/numbers.js
When you specify the path to a file, IntelliJ IDEA opens it in the 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, IntelliJ IDEA opens this project. If you open a directory that is not a part of a project, IntelliJ IDEA adds the .idea directory to it, making it a project.
Thanks for your feedback!
Was this page helpful?
Cookie Settings
Our website uses some cookies and records your IP address for the purposes of accessibility, security, and managing your access to the telecommunication network. You can disable data collection and cookies by changing your browser settings, but it may affect how this website functions. Learn more.
With your consent, JetBrains may also use cookies and your IP address to collect individual statistics and provide you with personalized offers and ads subject to the Privacy Notice and the Terms of Use. JetBrains may use third-party services for this purpose. You can adjust or withdraw your consent at any time by visiting the Opt-Out page.