How to Get a Unix-Like Terminal Environment in Windows and Visual Studio Code
Tags: vscode, cmder, terminal, cli
Published: 2023-09-28 20:31:26

In the vast world of software development, the terminal is an indispensable tool for many developers. It offers a powerful and efficient way to interact with the system, run commands, and manage files. For those who have delved into the Unix or Linux environment, the allure of the Unix-like terminal is undeniable. Its flexibility, combined with a rich set of command-line utilities, makes it a favorite among many. But what if you're a Windows user? Do you have to miss out on this experience?

Enter Cmder, a console emulator for Windows that brings the power and elegance of a Unix-like terminal to your Windows machine. And when combined with Visual Studio Code, one of the most popular code editors out there, you get an integrated development environment that feels seamless, efficient, and robust.

You may be asking, why should I use Cmder instead of Windows cmd.exe or PowerShell? Well here are several reasons:

1. **Unified Experience:**  
   By integrating Cmder with VS Code, you can access the terminal directly within your editor. This means no more switching between windows or tabs, leading to a more streamlined and efficient workflow.

2. **Powerful Command-Line Tools:**  
   Cmder brings a suite of Unix-like command-line tools to Windows. This allows developers to use familiar Unix commands, enhancing productivity and reducing the learning curve for those transitioning from Unix-based systems.

3. **Customizability:**  
   Cmder is highly customizable, from its appearance to its functionality. When combined with the extensibility of VS Code, developers can tailor their environment to their exact preferences.

4. **Enhanced Scripting Capabilities:**  
   With Cmder's Unix-like capabilities, developers can write and execute shell scripts directly in VS Code, even on a Windows system. This is especially beneficial for automation tasks and build processes.

5. **Tabbed Interface:**  
   Cmder supports multiple tabs, allowing developers to run and manage multiple command-line sessions within a single terminal window. This is particularly useful for multitasking, such as monitoring logs in one tab while executing commands in another.

6. **Portability:**  
   Cmder is portable, meaning you can carry your customized terminal environment on a USB stick or any external drive. When integrated with VS Code's portable version, you have a complete, portable development environment ready to go wherever you are.

7. **Active Community and Support:**  
   Both Cmder and VS Code have active communities. This ensures regular updates, a plethora of resources, and a wide range of plugins and extensions to enhance functionality.

Incorporating Cmder into your VS Code setup not only elevates your terminal experience but also bridges the gap between Windows and Unix-like environments. The synergy of these tools provides a robust platform, ensuring that developers have all the resources they need at their fingertips.

## Making it Happen

Assuming you already have Visual Studio Code installed, the first thing you'll want to do is [Download Cmder](https://cmder.app/). Extract the files to `C:\cmder`, or wherever you like.

Next, open VS Code and hit the F1 key to open the command menu. Type in *settings* and then click `Preferences: Open User Settings [JSON]`.

![Edit settings.json](https://cdn.designly.biz/blog_files/how-to-get-a-unix-like-terminal-environment-in-windows-and-visual-studio/image1.jpg)

If you don't have any user settings, you'll be presented with an empty JSON file with an empty object: `{}`. If you have existing settings, then you'll simply add some new entries to the bottom:

```json
{
    "terminal.integrated.profiles.windows": {
        "Cmder": {
            "path": [
                "${env:windir}\\Sysnative\\cmd.exe",
                "${env:windir}\\System32\\cmd.exe"
            ],
            "env": {"CMDER_ROOT": "C:\\cmder"},
            "args": [
                "/K",
                "C:\\cmder\\vendor\\init.bat"
            ],
            "icon": "remote",
        },
    },
    "terminal.external.windowsExec": "C:\\cmder\\Cmder.exe",
    "terminal.integrated.defaultProfile.windows": "Cmder",
}
```

What this does is create a custom terminal profile for all Windows environments. It tells VS Code to use cmd.exe to open `C:\cmder\vendor\init.bat`, which starts up Cmder. You can set the icon to any [Codicon](https://microsoft.github.io/vscode-codicons/dist/codicon.html).

Save your settings file and then hit CTRL+SHIFT+\`. You should see a new terminal with the Lambda (λ) symbol:

![Cmder as new terminal](https://cdn.designly.biz/blog_files/how-to-get-a-unix-like-terminal-environment-in-windows-and-visual-studio/image2.jpg)

That's it, now you have Cmder as your default terminal in VS Code! You get all of the classic GNU tools like `ls`, `grep`, `awk`, `sed`, `pico`, `vi`, etc. Enjoy!

---

Thank you for taking the time to read my article and I hope you found it useful (or at the very least, mildly entertaining). For more great information about web dev, systems administration and cloud computing, please read the [Designly Blog](https://blog.designly.biz). Also, please leave your comments! I love to hear thoughts from my readers.

If you want to support me, please follow me on [Spotify](https://open.spotify.com/album/2fq9S51ULwPmRM6EdCJAaJ?si=USeZDsmYSKSaGpcrSJJsGg)!

Looking for a web developer? I'm available for hire! To inquire, please fill out a [contact form](https://designly.biz/contact).