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 command keeps control of the terminal, so I don't get the shell prompt back until I close VS Code. Is there a way to launch it without blocking the terminal?
2 Answers
VS Code has its own option for this: `code --background`. You can make that the default by adding `alias code='code --background'` to your `.bashrc`. You can also use `code -n` when you want the command to open a new window. In general, commands keep the terminal occupied while they're running, so long-running programs either need a background operator like `&` or a command-line option that handles background execution.
Run `code . &` to start VS Code in the background and immediately return to the shell prompt. 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.
That makes sense—the ampersand lets the shell and VS Code run separately, while `disown` prevents the terminal from taking responsibility for the editor after it closes.

Thanks! I'll try the alias. How do people usually learn these terminal options—mostly by using the terminal regularly and checking command documentation when something behaves unexpectedly?