PhpStorm 2019.2 Help

Terminal Emulator

PhpStorm includes an embedded terminal emulator for working with a command-line shell from inside the IDE. Having a command line right inside the IDE lets you do things like running Git commands, and so on without switching windows and mental focus when you need to perform a quick command line task.

Initially, the terminal emulator runs with your default system shell, but it supports many other shells such as Windows PowerShell, Command Prompt cmd.exe, sh, bash, zsh, csh, and so on.

Open the Terminal tool window

Do one of the following:

  • Press Alt+F12.

  • Select View | Tool Windows | Terminal from the main menu.

  • Click the Terminal tool window button The Terminal tool window button.

  • Hover your mouse pointer over The tool windows icon in the lower left corner of the IDE, then choose Terminal from the menu.

By default, the terminal emulator runs with the current directory set to the root directory of the current project. You can change the default start directory on the Tools | Terminal page of PhpStorm settings Ctrl+Alt+S. If you right-click any file (for example, in the Project tool window or any open tab) and select Open in Terminal, this will run the terminal in the directory of that file.

Start a new session

  • Click the Add button on the toolbar. A new session is opened in a separate tab.

    New session in the terminal

Sessions are saved when you close the project or PhpStorm, that is, tab names, current working directory, and even the shell history is preserved.

To close an active session, click the Close button on the terminal toolbar or right-click the current session tab and select Close Tab from the context menu.

Switch between tabs

  • Press Alt+Right and Alt+Left to switch the active tab.

Alternatively, you can press Alt+Down to see the list of all terminal tabs.

Rename a tab

  • Right-click the tab and select Rename Session from the context menu.

Browse the history of entered commands

  • Use the Up and Down keys.

Configure the terminal emulator

  1. In the Settings/Preferences dialog (Ctrl+Alt+S), go to Tools | Terminal.

  2. Specify the desired shell to use with the embedded terminal emulator, change the start directory, and define environment variables among other settings.

    In case you want to use an alternative shell, here are some example paths you can configure:

    • PowerShell: powershell

    • Cmder: "cmd" /k ""%CMDER_ROOT%\vendor\init.bat"" (note the CMDER_ROOT environment variable has to be set)

    • Cygwin: "C:\cygwin\bin\bash.exe" --login -i

    • Zsh: /bin/zsh

    • Bash: /bin/bash (or bash for Windows: bash.exe)

  3. Optionally, configure the settings that the embedded terminal emulator inherits from the IDE settings.

    • On the Keymap page, you can configure the copy Ctrl+C and paste Ctrl+V shortcuts.

    • On the Editor | General | Appearance page, you can configure caret blinking. The setting Use block caret is not inherited in the terminal: its caret is always block.

    • You can configure visual presentation in the terminal on the following pgaes:

      • Editor | Color Scheme | Console Font: line spacing, and console fonts.

      • Editor | Color Scheme | Console Colors: console colors.

      • Editor | Color Scheme | General: selection foreground and background colors.

Last modified: 18 November 2019