Compared to the average computer user, programmers often have to interact more closely with various components of an operating system. Linux has increasingly become the platform for choice for many programmers. But why do we love Linux for programming?
To give an idea of the growing usage of Linux for programming, in the 2020 stackoverflow survey 55% of developers selected Linux as their platform of choice with Windows coming in second at 53.1%. Compare this to the 2015 stackoverflow survey which showed just 20.5% of developers using Linux.
Although Windows and MacOS take far more of the operating system market share for desktop users (source), Linux has its place in the programming world. If you’re a developer currently using Windows or MacOS and the nature of your development tasks allows it, you may consider making the switch to Linux.
Here we’ll go through some reasons that may convince you to make the switch to Linux for programming tasks. You can also find a more general introduction to Linux covered in this post.
Open source refers to software developed that’s free for you to use, view and modify the code if you wish. Such applications are typically managed by what is referred to as the open source community. This is a community made up of developers like you and me who give their time to contribute to projects driven by the users themselves.
Linux is an open source operating system. Countless open source applications have also been developed to run on Linux based systems.
The open source nature of Linux is an advantage because it provides you with full control of the applications you use. Since the source code is publicly available, you can choose to modify it to your own needs. Or if you happen to come across a bug while using the application, a bug report can be submitted to the community managing the software.
The git repositories for open source projects are typically found on GitHub, a platform already used by most programmers.
Linux itself being an open source operating system means every component of the system is visible. This encourages anyone to explore the system if they wish and learn the ins and outs of how it works.
In contrast, Windows and MacOS are proprietary operating systems and come installed with mostly closed source applications. This means the user doesn’t have visibility of how the system and its applications work as the source code is not made public. This can make it troublesome at times for programmers as you become totally dependent on the organisation managing the software to fix issues.
Having access to the source code of countless applications also makes a Linux based operating system a great platform for learning.
If for example you had an interest in learning how image editing software works, or you wanted to develop one yourself. On Linux there are tons of open source image editing programs such as KolourPaint and GIMP. You can view the source code for these, study it, and modify it to do whatever you want.
Having full visibility and control of tons of software applications is a great incentive to choose Linux as your development platform.
2. Linux is extremely customisable
The most used operating system Windows, ships as one type with a distinct appearance and a known set of applications.
At a system level, there’s no option for you to choose what applications come pre-installed with it. Within the desktop environment there’s not much room for customisation which means the look and feel of Windows tends to be the same for every user. In general Windows is quite rigid with not many options for customisation.
When it comes to providing users the ability to customise their system Linux is a clear winner here.
Since anyone can take Linux and other open source applications and package it to form an operating system, that’s exactly what many people have done. As a result there are tons of Linux based operating systems which are called “distributions” or “distro” for short.
Each distro packages applications, tools and desktop environments allowing each to provide their own appeal to the user.
We are spoiled for choice here when it comes to selection. There are distros geared towards beginners such as Ubuntu. Lightweight distros for running on old hardware such as Linux Lite. Or if you’re brave enough, you can go for distros that’s entirely command line based with no graphical interface.
The look and feel of the desktop environment is also highly customisable on Linux based systems. You can choose to change the desktop environment but keep the underlying system. For example, Ubuntu uses the GNOME desktop environment but you can also use Kubuntu, which is essentially Ubuntu but with the KDE desktop environment.
Within each distro there’s also typically tons of customisation options. You can change things like the file manager or install new themes. You can even tweak basic things like the system font and icons.
Of course you can also tweak these distros to your own liking or even create your own. For running Linux on Embedded devices, the Yocto project provides tools that help you develop a Linux based distro.
Programmers tend to love flexibility and options which Linux has plenty of. It means you’re able to tweak things to suit your environment either for your own personalisation or development purposes.
3. Neatly structured file system
Linux uses a tree-like file system structure. The most top level folder is known as root and is designated by a single forward flash “/”. This is the most top level folder in which all directories and files fall under. Under the Linux file system structure, similar files tend to be located under the same directory.
Windows is structured by placing files under drives designated by letters such as “C:\” or “D:\”. This means in Windows there’s no single dedicated root. On Windows, there is less of a standard to the way files and devices can be located on the system.
The structure provided by Linux offers some benefits over Windows.
First, there’s a better level of predictability of where system tools, utilities and applications will be located which makes it easier to navigate around the system.
For example, executables are usually located under the directory /usr/bin, system configuration files usually go under /etc, libraries under /usr/lib, user account files under /home, log files under /var/log and so on.
This structure makes it easier for anyone to locate files when configuring the system or when developing applications that manipulate these files. Applications can also make use of the same resource, for example, knowing where libraries are located will allow applications to share libraries.
On Windows, there’s less predictability in where programs and it’s relevant libraries are located. Compared to Linux, there isn’t as clear a structure to the way system files are arranged and the file structure can become quite scattered. This makes things more difficult when searching for and manipulating system files.
Linux therefore has the advantage of being more structured and predictable in where system files are located which makes things slightly easier for programmers.
4. Abundance of tools, packages and support for programming languages
With most of us starting out using Windows, you may wonder if Linux will have sufficient support for your development needs.
Well no need to worry because Linux provides support for the vast majority of programming languages. Most Linux distros also come pre-installed with compilers like gcc and interpreters for programming languages like Python. If native support isn’t already provided, it’s simple enough to add it on by installing the necessary packages.
I will note an exception for programming languages that are platform specific such as languages using Microsoft’s .NET framework. However, there are some ways to develop .NET applications using cross platform frameworks. So really, any language you can think of probably has some method or workaround of being developed on Linux.
Apart from programming language support, Linux also provides a large selection of tools useful for programmers. This includes advanced text editors, IDEs, debuggers and containers. The open source community also plays a role in the growth of Linux as many open source tools and applications useful for programmers continue to be developed.
5. Very powerful shell and scripting capabilities
This is one of my top reasons for using Linux and what drew me to using Linux when I first tried it out.
The Linux shell provides a command line interface to the entire system that allows you to perform actions by executing commands.
Linux is known for having a powerful shell with commands available to perform any tasks or sequence of actions available through the graphical interface and more.
When multiple commands are combined into a file to perform a series of commands it’s known as scripting. Bash scripting is probably the most used command line scripting language on Linux with a low barrier entry for learning.
One important factor that makes the ability to use scripting such a powerful technique on Linux is that everything on the system is treated as a file. Hard drives are files, serial ports are files, a connected keyboard is a file and obviously, files are files.
Why does this matter?
This allows tools and utilities to control the system using file manipulation. The ability to manipulate everything like a file means we can interact with the system using standard Input/Output commands.
The power of the Linux shell is an obvious attraction for programmers. It provides more control in how we interact with the system and a way of performing tasks such as automation through bash scripting.
As you get comfortable with the Linux command line or bash scripting you’ll not only discover new things about how applications interact with an operating system but you’ll hopefully have fun doing so!
However, with great power comes responsibility. It’s easier to accidentally do things like wipe your entire hard disk on the command line so be careful with this knowledge!
Linux based platforms provide everything you need as a programmer to be comfortable with your environment and the tools you need to develop software. More programmers are discovering the powerful advantages of choosing Linux as their development platform of choice.
Programmers love having control and flexibility, which is a primary reason for using Linux. It will likely continue to grow in popularity as the platform of choice for programmers and for good reasons.
Are you a programmer considering switching to Linux? What are your doubts if any? Do you already use Linux for programming tasks? Comment below!