As someone who has been using WSL (Windows Subsystem for Linux) from the beginning, I’ll explain the benefits of WSL for Linux and programming beginners.
A few years ago, with Windows 10’s Anniversary Update, Windows Subsystem for Linux was introduced. Also known as Bash on Ubuntu on Windows, commonly called WSL. To be precise, WSL refers not only to Ubuntu/Bash, but also includes other Linux distributions such as Debian and Kali Linux. However, in reality, it’s fine to think of WSL as Bash on Ubuntu on Windows.
As the name suggests, WSL is a system for running Linux on Windows. You can use almost all Linux commands available by default, and you can also install and use external packages like Python using apt.
Additionally, you can pass standard output from Windows’ built-in command lines like cmd.exe to WSL for processing, and vice versa.
It’s well known that macOS also has a similar command line, Bash, but macOS’s Bash is not complete. (WSL is also not complete, though.) Developers who previously used macOS to leverage Bash might now consider migrating to Windows.
However, there’s one thing that can be said for certain.
WSL has completely shattered the conventions of Windows 10.
Why Use WSL
For those who don’t regularly work with Linux or the command-line interface (CLI), this may be hard to grasp, but CLI interfaces are very useful software. For simple programming, it’s often faster to create your own solution rather than searching for and downloading software.
CLI mainly works with file operations and I/O. For example, things like these:
** Want to generate hundreds of files according to a rule. (1.txt contains the text 1, 2.txt contains the text 2, etc.) **
seq 1 3 | xargs -I {} bash -c “echo {} > {}.txt”
** Want to copy the path of the latest file in the Downloads folder to the clipboard **
find /mnt/e/_downloads/ -type f -printf ‘%T+ %p\n’ | sort -r | head -n 1 | sed -Ee ‘s/^.(/mnt.)/\1/g’ | clip.exe
** Want to copy all mp4 files in a folder as wav files **
for i in *.mp4; do ffmpeg -i “$i” -vn -acodec pcm_s16le -ar 44100 -ac 2 “$i.wav”; done
Converting all .mp4 files in a folder to .wav
** Want to add watermarks to images **
convert -size 280x160 xc:none -fill grey \
-pointsize 24 \
-gravity NorthWest -draw "text 10,10 'https://fumiya.org'" \
-gravity SouthEast -draw "text 5,15 'https://fumiya.org'" \
-channel alpha -evaluate multiply 0.30 \
miff:- |\
composite -tile - /mnt/c/_sharex/Screenshots/2019-02/ShareX_ScreenShot_6740af35-df45-4114-84d7-1ce0a124f851.png wmark_text_tiled.png
Creating watermarked images from CLI with ImageMagick
Once you can program these things, you can create most small software. You can rewrite to your preferred settings with a small record. With commercial software, you can only modify existing configurations.
CLI programming is the keystone of everything and very important. Even for programming with Ruby or Python, CLI knowledge is necessary. CLI is not only convenient but also practical.
The CLI in Linux’s Ubuntu is called Bash, and WSL, as its alternative name Bash on Ubuntu on Windows suggests, is the Bash language. This kind of file manipulation programming with Bash is made possible on Windows through WSL.
If you’re currently using Windows on a daily basis, have never used Linux, or are not familiar with it, there’s all the more reason to try WSL.
In fact, such command lines exist not only in Linux but also in Windows with cmd.exe and powershell.exe. You can do similar things using these command-line software. However, the code is completely different, so what you need to learn is entirely different. If you want to continue programming in the future, want to become a systems engineer, want to work with Linux, or want to create (write) more interesting things, I recommend choosing Bash (Linux) over PowerShell.
Why WSL Alone Is Not Enough
While WSL seems omnipotent, it has drawbacks.
First, note that not everything is possible.
The above answer states that GUI applications are not intended to be supported, but they are possible if you use an X server. That said, it's true that not all applications can be used.Can I run ALL Linux apps in WSL? No! WSL is a tool aimed at enabling users who need them to run Bash and core Linux command-line tools on Windows.
WSL does not aim to support GUI desktops or applications (e.g. Gnome, KDE, etc.) Frequently Asked Questions (FAQ) | Microsoft Docs
Let me give you a concrete example. First, “Ruby on Rails”. I had been working with Rails for quite a while, so of course I tried running it on WSL. But that was a mistake.
What happened as a result? Errors occurred. Unsolvable, unreproducible errors.
The Missing helper file helpers/c:/pg/rails/tool/app/helpers/application_helper.rb_helper.rb error is still unresolved on GitHub. It suddenly occurs on WSL without knowing what causes it.
Reinstalling Rails doesn’t solve this problem. It’s that kind of very troublesome bug.
Such errors have more than enough power to cause beginners to give up and quit programming.
What else? The inability to use the fuse package is also a major problem.
Add FUSE (Filesystem in Userspace) support in WSL – Welcome to the Windows developer feedback site!
What’s good about being able to use fuse? First, you can use sshfs. This is software for mounting remote Linux file systems on Linux. You can access and process remote files from WSL.
As such, WSL has many defects and things it cannot do. To compensate for these, the only solution is to use pure Linux.
Why Not a Computer with Linux Installed
I’ve explained this far, but some of you may be thinking:
** No, there’s no merit in bothering to create a Linux environment on Windows. Just use Linux (Ubuntu) normally. **
I used to think that way too.
Although I mainly use Windows 10, I actually worked on a computer with Linux installed for over a year. Indeed, if you work on Linux, there are no bugs, no restrictions, and it’s not a bad choice. However, I don’t recommend it. Why?
Because Linux has many bugs. First, having used Windows for nearly 7 years, I deeply feel Windows’ stability. The environment doesn’t break, data doesn’t disappear. What about Linux? I’ve had it fail to boot at least twice. Most things can be solved if you look them up. That’s if you have the ability to solve them (mainly English proficiency), but there are still cases that can’t be solved. With Windows, you don’t need much English ability to look up or ask questions, and as mentioned above, the risk of the environment breaking is low.
And here’s a fundamental premise that shouldn’t be forgotten: Linux is an OS designed for development, not for running middleware like Excel for work or general tasks. Nowadays, user-friendly Linux distributions have emerged and development has progressed, so using it as a free alternative to Mac or Windows is an option, but in reality, it’s still a work in progress.
Some people may resist choosing what’s popular, but with OSS (open source software), popularity is everything when it comes to selection criteria. (At least in my philosophy for over 3 years.) Popular things have many developers and active development. Projects with active development also find and solve bugs quickly. Do you know the distribution of Linux, Mac, and Windows users? Roughly speaking, it’s 1:3:7. Think of Linux’s development efficiency as 7 times slower than Windows’ development efficiency, and it becomes simple.
In summary, I don’t recommend using Linux as the foundation OS for all environments. At least not as of 2019.
I’ll skip the details here as it’s off-topic, but when using Linux, we choose options like Docker or VirtualBox. With Docker, we build not on Windows but via SSH on pure Linux. (I don’t recommend Docker on WSL (Windows) as it leads to results similar to Ruby on Rails mentioned earlier.)
WSL is not omnipotent. However, it’s within a range that poses no problems for practical use. Also, as an easy opportunity to get hands-on with Linux, the barrier to entry for non-programmers is low. There’s no need to hesitate in starting with WSL. If you want to work with Linux, programming, or systems engineering in the future, WSL will be a good practice partner for you.
Thank you for your attention.
The following article explains how to install WSL.
WSL bash on ubuntu on windows installation procedure
Recommended WSL articles are below:
[Execute Windows executable files from WSL bash](https://yuis-programming.com/?p=690)
[Copy Bash on Windows (WSL) output to clipboard](https://yuis-programming.com/?p=1045)
[Open graphical window apps with Ubuntu VPS -> WSL -> Windows X11 forwarding](https://yuis-programming.com/?p=1351)
[Create a simple timer app with WSL Bash and PowerShell](https://yuis-programming.com/?p=1514)
Recommended Bash articles are below:[Measure internet speed in Bash (download/upload)](https://yuis-programming.com/?p=1361)
[How to disable the freeze function with Bash ctrl-s](https://yuis-programming.com/?p=1239)
[Execute commands when files change with Bash inotifywait](https://yuis-programming.com/?p=1363)
[bash: Streamline image conversion with imagemagick](https://yuis-programming.com/?p=339)