I am using vscode on Ubuntu 20.04 LTS. I have set my ubuntu's terminal preferences as Run command as login shell (bash). Now, i open vs code. It also opens up the integrated bash terminal. I wanted to know whether "run command as login shell" is enabled on vscode also?
I was looking for the same thing today. I think I figured it out as I'm not getting the errors I was before.
I followed the documentation here: https://code.visualstudio.com/docs/editor/integrated-terminal#_configuring-profiles
I added a "terminal.integrated.profiles.linux" entry in the settings.json file and it auto-added entries for each of the available terminal types. I edited the one for bash to add "args": ["--login"] and then opened up a new terminal tab and the new one worked.
Here is the full entry that was added to settings.json:
"terminal.integrated.profiles.linux": {
"bash": {
"path": "bash",
"icon": "terminal-bash",
"args": ["--login"]
},
"zsh": {
"path": "zsh"
},
"fish": {
"path": "fish"
},
"tmux": {
"path": "tmux",
"icon": "terminal-tmux"
},
"pwsh": {
"path": "pwsh",
"icon": "terminal-powershell"
}
}
You can run shopt login_shell to verify if the terminal is running as a login shell. It will print login_shell on if it is
With Pop!_OS 22.04 and VS Code 1.70 adding this to my user settings.json worked:
{
"terminal.integrated.profiles.linux": {
"zsh (login)": {
"path": "zsh",
"args": ["-l"]
}
},
"terminal.integrated.defaultProfile.linux": "zsh (login)"
}
This adds a new profile and sets it as the default rather than attempting to override built in profiles.
https://code.visualstudio.com/docs/terminal/profiles
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With