I'm following The Odin Project to learn web development and use Ubuntu through WSL. When I run `code .` to open Visual Studio Code, the terminal stays occupied instead of returning to the shell prompt, so I can't type another command until I close VS Code. Is there a way to open the editor without blocking the terminal?
2 Answers
You can run `code . &` to start VS Code in the background and immediately get your shell prompt back. If you also want it to keep running after the terminal closes, use `code . & disown`. The `&` backgrounds the process, while `disown` removes it from the shell's job list.
VS Code has a built-in option for this: run `code --background .`. To make the normal `code` command behave this way, you can add an alias to your `.bashrc`: `alias code='code --background'`. Commands launched from a terminal normally keep the shell occupied until they exit, which is why VS Code blocks the prompt. The `--background` option tells VS Code to handle this itself. You can also use `-n` when you want to open a new window.
I'll try the `--background` option. How do people usually learn these terminal options—mostly by using the terminal regularly and checking command documentation?

Thanks for explaining what those commands do. That makes a lot more sense now.