I'm using WSL2 on Windows terminal. I have an app that needs front end and backend booted before it can be used, so every time I nave to open a terminal window, navigate to a folder and run a command. I would like to set an alias that would open a new tab, navigate to a folder and do go run . I saw suggestions for linux, but none of those work on Windows Terminal with WSL2. Anyone have experience with this setup?
Asked
Active
Viewed 2,724 times
1 Answers
1
You could create a profile for this. Something like
{
"commandline": "wsl.exe -d Ubuntu ping 8.8.8.8",
"name": "backend",
"startingDirectory": "\\\\wsl$\\Ubuntu\\home\\zadjii\\path\\to\\project",
},
(of course, replace ping 8.8.8.8
with the actual command you want to run, replace Ubuntu
with the name of the distro you're using, and replace home\\zadjii\\path\\to\\project
with your actual path, delimited by double-backslashes.)
Now, if you wanted to get really crazy, you could create an action in the Command Palette which opened up multiple commands all at once:
{
"name": "Run my project",
"command": {
"action": "multipleActions",
"actions": [
// Create a new tab with two panes
{ "action": "newTab", "tabTitle": "backend", "commandline": "wsl.exe -d Ubuntu run_my_backend", "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\zadjii\\path\\to\\backend" },
{ "action": "splitPane", "tabTitle": "frontend", "commandline": "wsl.exe -d Ubuntu run_my_frontend", "startingDirectory": "\\\\wsl$\\Ubuntu\\home\\zadjii\\path\\to\\frontend" },
]
}
}
see multipleActions

zadjii
- 529
- 2
- 4