IntelliJ IDEA 2016.3 Help

Running Command Line Tool Commands

On this page:

Introduction

You can run commands and analyze their output right in IntelliJ IDEA using the dedicated Command Line Tools Console tool window.

The character set to be used in the tool window is chosen from the Console encoding drop-down list on the Command Line Tool Support page of the Settings/Preferences dialog box. If necessary, you can export the output.

Note that PHP-specific command line tools work only with local PHP interpreters, see Configuring Local PHP Interpreters and Enabling PHP support.

Executing a command in the command line

To execute a command in the command line

  1. To access the Input pane, choose Tools | Run Command on the main menu.

    Depending on the Show console in setting in the Command Line Tool Support page, the Input pane opens either as a pop-up window or as a text box at the bottom of the dedicated Command Line Tools Console tool window.

  2. In the Input pane, type the call of the command in the format:
    <tool alias> <command>
    1. Besides tool-specific commands, you can also run simple, operating system-wide, commands, such as, ls, etc.
    2. Most command line tools operate within the context of their own projects. A tool project is not the same as a IntelliJ IDEA project. Therefore, when using a tool from IntelliJ IDEA for the first time, you need to create its own "initial" tool project besides you current IntelliJ IDEA project. To do so, run the project generation command specific for the current tool in the Command Line Tool Input pane. The "initial project" is located in the IntelliJ IDEA project root.
  3. View the result of command execution in the output tab named after the last invoked command.

Terminating a running command

To terminate a running command, do one of the following:

  • During the command execution, click the Stop toolbar button /help/img/idea/2016.3/stop.gif.
  • Kill the current thread from the progress bar, if the output tab is already closed.

Exporting the output

To export the output

  1. Click the Export to Text toolbar button /help/img/idea/2016.3/exportToTextFile.png or press Alt+O.
  2. In the Export Preview dialog box that opens, do one of the following:
    • To have the output saved in a text file, specify the target text file in the Export to file text box and click the Save button. If the file with this name and location already exists, choose to overwrite its contents with the new data or to append the new data to the existing file.
    • To copy the output to the clipboard, click the Copy button.

Launching a command line tool automatically after checking in changes

To have IntelliJ IDEA launch a command line tool automatically after checking in changes to the repository

  1. Open the IntelliJ IDEA settings and configure the required command line tool as an external tool on the External Tools page.
  2. Start checking in your changes.
  3. In the After Commit area, specify the tool to launch in the Run tool drop-down list. Choose one of the available tools or define a new one: click /help/img/idea/2016.3/browseButton.png and configure the required command line tool as an external tool in the External Tools dialog box that opens.

See Also

Last modified: 21 March 2017