Since its inception in 2016, Windows Subsystem for Linux — better known as WSL — has been widely used by developers and tech enthusiasts for natively running Linux command-line utilities on Windows. Over time, Microsoft has added a few more features to the compatibility layer as well.
[Image source – Microsoft]
Run commands on start-up in WSL
In the most recent build of the Windows Insider update, the company has added support for running Linux commands during the startup of a Windows Subsystem for Linux distribution. It means the command would run whenever the WSL system starts up.
As you probably know, the WSL environment allows users to run Linux command-line utilities using an app called Bash.exe. However, even in the current Windows 10 and Windows Server versions, the user must first set up the WSL environment before adding the command.
A few exceptions can be made in this category. Most importantly, users can now go to /etc/wsl.conf file of the WSL distribution and provide the Linux command that needs to run whenever the environment has been turned on. Along with this, the company has included a few options to keep track of these commands.
Microsoft has demonstrated how a simple change in the configuration file can set up a timer log whenever the WSL environment is up and running.
In the blog post, Microsoft also adds that a WSL environment is designed to keep running for a few more minutes even after all the system’s Linux processes have been closed. At the same time, developers can understand the running processes and shut-down all the WSL distributions through a single command.
The addition of this option is just one of the many features in the Windows Insider Build. The build is bringing some UI changes and some brand-new options for disk management and analysis. If you are part of the Insider Community, you can start using these now.
- Tags: Linux