Windows Command Line
Windows Terminal, Console and Command Line, Windows Subsystem for Linux, WSL, Windows Package Manager
Latest posts
Windows/WSL Interop with AF_UNIX
Starting in Windows Insider build 17093, a WSL application can communicate with a Windows application over Unix sockets. Back in December, we blogged about bringing AF_UNIX to Windows. Now, we're building on that functionality. Consider a requirement where you want to run some kind of service as a Windows application. Additionally, you would like to make this service available to both Windows and WSL applications. Now, that’s possible with Unix sockets. How To Code Let’s look at how the code for such applications would be written. The code for this application is at the bottom of this article. One thing worth...
OpenSSH in Windows 10!
SSH is one of the most important tools in the *NIX world, through which users communicate with shells, applications, and services running on remote machines, devices, VM's and containers. Windows users most often remotely access Windows machines, devices, VM's and Containers via the amazingly powerful Remote Desktop Protocol (RDP) which, as the name says, remotes the entire Windows UX. But sometimes you only want to access & drive command-line tools - for which, RDP is both overkill and a poor fit. For this reason, PowerShell users use PowerShell Remoting which offers similar features to SSH, but via a diffe...
Tar and Curl Come to Windows!
One of the most frequent asks we hear across the entire Windows command-line spectrum is "I need curl" and/or "I need tar". If you're one of these people - HAPPY NEW YEAR! :) Windows 10 Insider build 17063 and later now include the real-deal and executables that you can execute directly from Cmd or PowerShell. Our sincere thanks to the LibArchive and curl.haxx.se teams who created and maintain bsdtar and curl, respectively. For more details, read Craig's announcement post: "Tar and curl come to Windows"
Chmod/Chown WSL Improvements
We've added new file system features to WSL in Insider Build 17063. You can now set the owner and group of files using chmod/chown and modify read/write/execute permissions in WSL. You can also create special files like fifos, unix sockets, and device files. We're introducing new mounting options with DrvFs for projecting permissions onto files alongside providing new Linux metadata on files and folders. There's one step you must take before you can enjoy these new features: you must unmount drvfs and remount it with the 'metadata' flag. To do this: sudo umount /mnt/c sudo mount -t drvfs C: /mnt/c -o metadata ...
Share Environment Vars between WSL and Windows
Hey WSL users—we have more features to share with you! Our latest Windows Insider build lets you share environment variables between WSL and Windows. Starting with Build 17063, let’s look at how you can leverage the new “WSLENV” to enhance environmental variable interop between Win32/WSL. Summary For the pros who’ve already heard about WSLENV and just want to know how it works, see below for a quick synopsis: A sample of how a WSLENV could possibly look: What are Environment Variables? Environment variables are a way to store configurable values across your entire system—all your programs have ac...
AF_UNIX comes to Windows
Introduction: Beginning in Insider Build 17063, you’ll be able to use the unix socket (AF_UNIX) address family on Windows to communicate between Win32 processes. Unix sockets allow inter-process communication (IPC) between processes on the same machine. Overview: Support for the unix socket has existed both in BSD and Linux for the longest time, but, not on Windows. On Windows, there were some alternatives for local IPC, such as named pipes. But, calling conventions are different between the named pipes and sockets, making writing low-maintenance cross-platform applications difficult. For example, one such ...
[Cross Post] WSL Interoperability with Docker
We frequently get asked about running docker from within the Windows Subsystem for Linux (WSL). We don’t support running the docker daemon directly in WSL. But what you can do is call in to the daemon running under Windows from WSL. What does this let you do? You can create dockerfiles, build them, and run them in the daemon—Windows or Linux, depending on which runtime you have selected—all from the comfort of WSL. Overview The architectural design of docker is split into three components: a client, a REST API, and a server (the daemon). At a high level: ...
Background Task Support in WSL
Starting in Windows Insiders Build 17046, WSL supports background tasks (including daemons). In the past, if you opened WSL and started sshd, httpd, screen, or tmux you needed to have a console window open to keep those tools running. But, starting with 17046, these processes will continue running in the background even after the last console window has been closed. Elevated and Non-Elevated WSL Instances As part of background process support, we have incorporated your asks for a better experience while running multiple WSL instances (WSL in 2+ console windows) as per a discussion from our GitHub repo. You can...
A Guide to Invoking WSL
There are a variety of ways to invoke the Windows Subsystem for Linux from Windows commandlines and they all behave a little differently. Let’s get to the bottom of it. “wsl” The first (and recommended!) method will start up your default distro. Additionally, it starts the distro in the current working directory where you invoke the command. You can change the default distro by using the “wslconfig” tool. In the example below, we’ll launch into the default distro (Ubuntu) in the current working directory. Then we’ll exit and change our default distro to SUSE. “” Alternatively, you can specify by nam...