Project work often moves between editing a file and running a shell command. The integrated Terminal in IntelliJ IDEA on the Linux desktop lets you run commands alongside the editor and check which folder the shell is using.

The shell resolves relative file paths from its working directory. With the default settings, a new local terminal session starts at the root of the open project, where its top-level files live.

IntelliJ IDEA can restore terminal tabs from an earlier session. A restored tab can still be in the folder you last used, so the open project name alone cannot tell you where a command will run.

Steps to use the integrated terminal in JetBrains IDE:

Start with a trusted local project open in IntelliJ IDEA, the project tree visible in the Project tool window, and the Terminal tool window hidden. IntelliJ IDEA shows its main menu under the Main Menu button in the window header, as in a new installation. The pictures use ~/IdeaProjects/hello as the project folder. PyCharm also puts Terminal under View > Tool Windows.

If you see Trust and Open Project before the project opens, trusting the project can let its code run. Choose Trust Project only if you recognize the folder and trust its source. If the source is unfamiliar, stop at the prompt. If GNOME asks you to Choose password for new keyring, you can select Cancel to continue. Start at step 1 once the project window is ready.

  1. Open Main Menu in the project window header.
  2. Point to View in the main menu.
  3. Point to Tool Windows in the View menu.
  4. Select Terminal from Tool Windows.
  5. Run pwd at the Terminal prompt under your usual Linux account.

    The pictured session prints /home/reader/IdeaProjects/hello.

  6. Confirm that the path printed by pwd matches the location beside the top-level entry in Project.

    The example entry shows ~/IdeaProjects/hello. The ~ stands for the home folder, /home/reader in the example, so the entry matches /home/reader/IdeaProjects/hello. If your paths differ, pause before running commands that assume the project folder.

Share this guide