How to run Linux commands when starting Windows Subsystem for Linux on Windows 10
Microsoft has just added a new feature for Windows Subsystem for Linux (WSL) on Windows 10. Specifically, WSL users on the latest beta version of Windows can set up Linux commands to automatically run when WSL starts. .
WSL is a compatibility layer designed by Microsoft to help Windows 10 run Linux binaries in native ELF format on Windows computers. In other words, users can run Linux commands right on Windows 10 without having to parallel install and switch between Linux and Windows.
How to run Linux commands when starting Windows Subsystem for Linux on Windows 10
Condition:
- Update the latest Windows 10 beta, Build 21286
- Install WSL
Doing:
- Edit /etc/wsl.conf and add an option titled command below the section titled boot
- Once added to the /etc/wsl.conf file , Linux commands will automatically run when the WSL distributions are started.
- WSL distributions will still run for a few minutes even after the Linux process inside them is closed
- You can check the distributions that are running using the command
wsl --list --verbose
and manually turn off all WSL distributions with the command.wsl --shutdown
If the testing goes well, this feature will soon be released by Microsoft in Windows 10 official release. Expected in 2021, Microsoft will have many updates and upgrades worthwhile for Windows 10 in terms of both interface and features.
Good luck.
You should read it
- How to Run Linux Commands on Windows with WSL 2
- Instructions for installing Windows Linux Subsystem on Windows 10
- 5 Linux commands every sysadmin needs to know
- 14 interesting Linux commands in Terminal
- Guide to network operation for Linux users: 11 commands to know
- 15 Tar commands should try in Linux
- Basic Linux commands everyone needs to know
- How to create dual boot Linux and Windows 10 on Linux
- How to Boot Linux from USB on Windows 10
- How to install Windows Subsystem for Linux 2 on Windows 10
- Useful commands in Unix / Linux
- Should Linux dual boot?
Maybe you are interested
How to resolve WSL error 4294967295 on Windows
How to update or downgrade WSL kernel on Windows 11
How to completely uninstall WSL on Windows 10/11
You Don't Need Microsoft Windows Subsystem for Linux (WSL): Here's Why!
How to set up Python to program on WSL
How to set up VS Code with WSL 2 on Windows 10/11