Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change default working directory for VS Code terminal

Is it possible to change the working directory for new integrated terminal windows in Visual Studio Code?

I have opened the folder /path/to/project in Code, so when I open a new terminal windows, it starts in that folder. I would like the terminal to open in /path/to/project/app so that I don't have to cd to that folder every time. Is it possible to configure this in settings.json?

like image 918
toryan Avatar asked Jul 24 '26 05:07

toryan


1 Answers

It turns out this was fairly easy to find in the documentation at https://code.visualstudio.com/docs/getstarted/settings.

The setting that controls this is

  // An explicit start path where the terminal will be launched, this is used
as the current working directory (cwd) for the shell process. This may be
particularly useful in workspace settings if the root directory is not a convenient cwd.
  "terminal.integrated.cwd": "",

This can be added to settings.json in the .vscode folder. Absolute and relative paths are supported, so

"terminal.integrated.cwd": "app"

and

"terminal.integrated.cwd": "/path/to/project/app"

will both work.

like image 98
toryan Avatar answered Jul 26 '26 20:07

toryan