Ask HN: Why use Linux for coding?

27 points by pyeu ↗ HN
I'm learning coding. I use Windows. But I have heard that Linux is the best choice OS to start learning programming. What do you think?

45 comments

[ 2.5 ms ] story [ 99.4 ms ] thread
If you're new to programming, and you're already a proficient Windows user, stick with Windows. The main advantage to developing with Linux is the vast availability of free and open source tools for writing and compiling code.

10 years ago the situation was a lot different but now even Microsoft is a huge proponent of open source development tools.

I like Linux for programming because a lot of the tools you're going to use originated on Unix like systems and are easier to setup and use. It really depends on what kind of programming you're trying to learn though. Are you going to use C#/.NET/ Visual Studio? Then stick with Windows. Personally, I think setting up environments for Python, C, MySQL is better on Linux.
(duplicate of https://news.ycombinator.com/item?id=16384949 from an hour ago)

Linux and starting to learn programming: if your goal is to learn programming (python) then the operating system doesn't matter. I'd concentrate on popular Python libraries. Switching from Windows to Linux will only grow the number of unknown systems/pieces to feel uncomfortable with and add distraction. It's fun to learn, just separate from programming.

I note you submitted 9 questions in the last day alone. This week 4-5 questions just which IDE/text-editor other developers use, the answers tend to repeat. There will always be a better coding setup (grass is greener) and the preference of editor is as old as programming itself.

Yes, looking at all the submissions, they appear to me to be generated by somebody who tries to game the HN:

https://news.ycombinator.com/submitted?id=pyeu

Giving the OP the benefit of a doubt I'm really just learning to program and have many of the questions the OP has asked. Reading the comments to these questions does actually help me make more informed decisions based on the knowledge and experience of you guys. Gaming or not they are of benefit to some.
Somewhat-shrug.

For me, Linux (or even OS X) is better because in general building existing packages is easier than on Windows. A lot of tooling is built on Unix-y platforms: to use Windows you have to play a lot more games.

To be fair, Windows has vastly improved its support for many of the most common tools, and cross-platform development has advanced enough that it's not the major issue it once was.

Linux gives you control. Compare compiling C++ code with Visual Studio vs. gcc. Yes, it is easier to get started with VS but you don't have as much control. With gcc (and my build tool of choice) I can control every step of the compilation and linking process.

It's "learning what's under the hood" - which I guess is an expression that comes from auto mechanics. To really learn how cars work you need to open the hood and interact with the engine.

You can use Microsoft compiler from command line as well. Some people do, and only jump into VS for debugging. Linux, on the other hand, does not provide a comparable debugging experience.
>Compare compiling C++ code with Visual Studio vs. gcc.

That is not a valid comparison as Visual Studio is an IDE and gcc is the compiler. It would be no different if you were using CLion from Jetbrains on Linux to do C/C++ work. The compiling would be handled all through the IDE. You are more than able to get down and handle building C++ from command line by using cl

I know you can use cl.exe directly, but it is not the same. For example, you can't even suppress its output completely. https://social.msdn.microsoft.com/Forums/vstudio/en-US/9eabe...
As much as I dislike MSVC, I'm still not sure that's a fair comparison. I've used cl.exe in large, complex makefiles to build programs that could also change CC and CXX to gcc or clang. And as far as output suppression goes, couldn't you pipe it somewhere else? I've had to do the same trick on Linux utils (pipe to /dev/null).
I've been "coding" full-time for two years now and I use Windows as primary operating system, the biggest issue/pains that I've experienced is:

1) Most of the tutorials online are written for linux 2) installing dependencies on windows is a bitch sometimes (75% of time I can get stuff to work on windows other times I give up because of lack of availability of certain packages and compiling issues).

It's my opinion that you will eventually need to learn how to operate in linux, so what I'd recommend you do to help with learning: - Install Hyper-V if you have Windows Professional, this way you can install various linux distros (start with ubuntu, then debian, then centos possibly). - install Bash for Windows - install docker for windows

http://www.evernote.com/l/AUkyLCQy0YJFQYIxEsVqV1nD1fUEpd4Uqf... ^ how to turn on hyper-v and bash for ubuntu on windows

(comment deleted)
Because a develper can keep GUI code or whatever out of the way. Because a developer can get tools for free, without having to justify the purchase to managers, directors, etc etc. Because a huge range of any given tool is available, from compilers to interpreters to text editors to testing frameworks. Because Linux distros aren't full of bad design decisions, like carriage return/linefeed end-of-line markers, drive letters, and magic device names that can shoot you in the foot very easily. Because developers can generally look at the source code of everything to figure out if the developer made a mistake or the underlying code has a mistake. Because Linux distros, unlike Microsoft, generally don't believe that they know what developers want to do/need to do, and don't prevent certain actions. Because developing on Windows puts you one patch Tuesday from your product being a DLL in Windows. Because freedom. Because good taste. Because Windows isn't very customizable. Because Microsoft does not document the real Windows system call interface/ABI.
To the degree there is a better operating system for starting to program, the operating system a beginner uses is orders of magnitude less important than just sitting down and writing code. The best operating system for learning to code is the operating system you are using.

The only certain thing Linux is the best operating system for is learning Linux. Learning Linux is not learning to code. It is not a step on the path to learning to code. Mostly, it is a distraction from getting started. There is time to learn Linux later...http://norvig.com/21-days.html

Good luck.

I disagree. The best operating system to use for learning to program is the operating system that stays out of your way, allows you to easily install your dev environment, and allows you to keep things reasonably up to date. For me, that's using Linux.

The last thing I want to do when learning a new programming language is waste a lot of time trying to install all of the dependencies/libs/compilers, being nagged by the OS to reboot because updates were installed, having cortana randomly pop up (it's like the modern day clippy), and deal with a host of other things that windows does to get in your way.

Over time, a person's needs change. The argument that Linux is the best operating system for learning is equivalent to one that Emacs/Vim/Eclipse/VScode/PyCharm/etc. is the best editor/IDE for learning to program or that Python/Javascript/C/VB/PHP/Java/etc. is the best language for learning to program.

The important part of learning to program is sitting down to program and sticking with it despite its difficulty. Developing habits of mind is what makes a person a programmer. A lot of beginning programming resources are OS agnostic because they run on the web and Firefox/Chrome/Edge/Safari/etc. are fungible (and of course HTML/CSS/Javascript are also OS agnostic).

I have god 15 years of experience and generally only a small part of my time is spent "programming". A lot is about setting up servers, databases, setting up my dev environment set up to reproduce bugs. Assuming you are writing software that runs on a Linux based server it's pretty useful to know how it works.
I disagree with this comment because, while everything said is technically true, it ignores the fact that it's a big trade-off.

Going with "the operating system you are using" does optimise quite a few things; these are the "pros" of this approach, things like:

- not burdening yourself with the learning curve of a new OS at the same time as you undergo the learning curve of programming

- being able to ease the programming effort by taking advantage of microefficiencies you've already gained from friend use of the OS.

- etc.

This has to be weighed against potential cons though:

- how long do you intend to program for (presumably some large multiple of the time it would take to learn a new OS)

- what is the actual difference in overhead of using development tools on the two OSes–if you're repeatedly undergoing a little extra overhead for every dev task on your current OS, this builds up over time

- if you intend to simply defer learning Linux to a later date, what's involved in switching your dev setup over? Will there be habits and disinformation to unlearn in the process?

A beginner, by virtue of being a beginner, does not have the experience to evaluate the tradeoffs as applied to their unique circumstances. On the other hand, sticking with the goal of learning to program is going to mean overcoming a mountain of technical issues no matter what. Overcoming technical issues and persevering through difficult problems is the heart of programming.
Because of the generally superior command lines and command line tools you get with UNIX and UNIX-like operating systems like Linux or macOS.

Recently, Windows has somewhat caught up in that respect but so far nothing beats a native Bash (or similar shells) environment.

> I'm learning coding. I use Windows. But I have heard that Linux is the best choice OS to start learning programming. What do you think?

There are a number of interesting technologies that have better supported dev environments and less frustration for the inexperienced on Linux, but there is plenty you can learn and do fine on Windows, and that avoids the cost of learning a new OS just to learn the basics of programming.

Linux can wait.

(Note, if you have a particular thing you are learning for, and the best tool for that is heavily Linux -- or, at least, UNIX-like-OS -- biased, you might want to learn Linux early on so you can use it, but otherwise, there's time for that later.)

I program on Linux here's why.

1. Every library known to man exist for Linux and is very easy to install, build from source, hack on, and customize, especially if you know what you are doing. This is comparably easy enough on Mac since its Unix based but Windows is its own beast when it comes to building from source and getting custom libraries working, etc.

2. You have complete control of your operating system and programming environment.

3. I don't program for iOS or .NET, so I don't need anything offered by other operating systems for Development purposes.

4. The languages I do program in have great ecosystems and development environments on Linux. These are : Android, Ruby, Java, JavaScript, Python, R and the occasional C/C++.

5. I don't write desktop software and virtually all software I create is deployed on Linux systems, so I write my code in a similar environment to the one its going to get run in (exact environment using docker, vms, etc if necessary).

6. Finally, I'm philosophically much more aligned with the democratic and decentralized spirit of Linux and Open Source than I am with closed source and centralization espoused by Msft and Apple. Admittedly, if their products were significantly better for my purposes as a programmer - I'd use them, since I'm not a Richard Stallman, but this is still one of the reasons I continue to use Linux. I think its a positive thing for the world.

I was already a coder long before I learned to use Linux. It was a steep learning curve to jump into Linux. I'd say it was worth learning absolutely, and now with 13 years experience with Linux it is my favorite OS to code in.

But if you're just now learning to code, focus on that and use whatever OS you are already comfortable with.

With that said, when I made the switch to Linux, I also decided to learn C. So I had two new things to learn and both had a steep learning curve, but C and Linux go hand in hand and are complementary skills. It was a lot of fun.

Depends on what you want to build. iOS software and you will need a mac. Microsoft stack and you will need windows.

If you are doing more general web development then there is a good chance you will be using a Linux server so it makes sense to learn it - your dev environment will be more similar to your production environment. There is plenty of open source software and material available so you can try things out.

I code on all three platforms but whatever I do I keep ending up in Linux just because it’s so more powerful and useful (but hard). Second best is macOS even though lately it’s been a suck fest. I have coded in Windows for Windows but it’s clunky, awkward and riddled with bad APIs. If you don’t want to know what a machine does or appropriate problems, chose Windows. Also it doesn’t give you the mechanical sympathy which Linux breathes. Linux is better if you want to run something with raw technologies. Sure it’s harder to learn, so macOS is a better starting point, if you can afford it. Also I think Linux is a lot less opinionated than the others which means it’s easier to come up with your own ideas.
I agree except I might swap macOS with Linux, because there's a lot of helpful macOS-only software, a good selection of proprietary software, and I think macOS is generally easier to deal with.

I recently moved to a job where my development laptop is Windows-based, after having a Macbook Pro at the last gig (I'm told we're working on getting Macs for developers). Windows 10 is still pretty bad in a lot of ways, large and small. Not having homebrew, apt, or yum to manage packages is a pain. I'm using elementaryOS running in VMware Workstation as my primary dev environment for the time being...

Eh. Everything is basically just there, or very very easy to get (just apt-get it). It's very easy to have a working development environment that doesn't get in the way.

Plus, every aspect of the operating system is ready to be explored, if you want. If there's something you don't like, just change it, rebuild your program, and you're good to go.

Because windows 7 will simply never be fully compatible environment for ruby + gems with native extensions.

So I prefer to run Linux in a vm and focus on coding vs. trying to fit a square peg into a round hole and spend my time o troubleshooting the environment.

It's the best OS for me because I containerize as much as I can (I use a separate docker-compose file for every client, for example). I've tried Docker on Mac, Windows and Linux, and it _just works_ on linux. The others were a major pain.

The added benefit of doing it this way is that I'm not really tied to a machine - all I need to do is clone my repos onto a new machine and I'm basically good to go.

Almost all developers I personally know use a Mac. I know a few that use Linux on occasion. I personally know of no developers that actively use Windows for writing code. However, I'd argue that using the OS you use for development is less important than understanding what is happening when you run software on any platform.

Ultimately you'll need to deploy software somewhere, and you will need to understand what is happening when the software has a problem. You often won't have a choice about the operating system on which your software is deployed, and you will still be expected to understand the OS well enough to work with it.

I say focus on understanding what is happening to the extent that you can. Always be curious. Always learn. Always strive to learn what question you should be asking to get the answers you seek. And when the trusted advisors & Google fail to answer your questions, that's where the real adventures begin. And, if you'd like to make money, don't forget make find a way to get paid.

Since stuff that I write runs on Linux I use Linux for everything.
Because Windows is now an OS-as-a-service, except running on your own damn computer. Meaning you ultimately don't control the OS, or your computer. As an open-source kernel and OS stack, Linux gives you that control back.

Ceding some control for putative convenience might -- MIGHT -- have been justifiable in the 90s. But it's 2018, Linux graphical shells are on fleek (if that's your thing), and your only excuse is if there's some app you NEED which requires Windows and doesn't work with Wine. Which isn't a problem for developers, except on a few proprietary platforms (like iOS).

Defaulting to Linux as you learn to develop software will build the skills you'll need to remediate the "software to do X is not available on Linux" problem should you come across it.

(comment deleted)
For learning how to code, you are perfectly fine on Windows. You are going to read lots of technical arguments in here about why you should use Linux or a Mac. You are learning how to program, so once you progress outside of an editor and compiler and want to learn more about a certain specialty you may want to investigate things related to that specialty.

The reason Linux is used a lot is that a lot of software development is writing web applications which typically run on Linux on servers. You can explore Linux on your Windows machine using tools like VirtualBox to create a virtual machine running Linux. You don't need to dual-boot, reformat your system, or spend any money to learn it.

What flavor of Linux should you learn? It doesn't matter for just starting out. You could post a question and get lots of technical arguments about one vs the other.

For a lot of technical topics, the same concept applies - you are in a learning phase, pick a common one (programming language, operating system, etc.) and learn using that. Once you reach a comfort level and feel confident you can "get things done", investigate differences between what you learned and other options out there.

(comment deleted)
Reading this on Mint Linux machine. I had used Windows and Mac almost all my life up until I joined a startup about 2 years back when I was given a 16gb 128 SSD Dell laptop with Mint 18 on it. TBH I was not very excited initially But fast forward 2 years I can now say with a fair degree of confidence that there is no going back for me ever. One can possibly do everything and only better and faster on a Linux like Mint running on good hardware. I can only say this to fellow developers if your job is to write code or scripts or automation on a day to day basis Linux is the place to be. You'll get better every day, effortlessly. I reboot my machine every once in a few months and it has never ever crashed on me, It hanged once I plugged a specific projector one time but I could recover it without full reboot, and to put things in perspective I install and uninstall pretty crazy stuff on almost on a daily basis and it wakes up from hibernation in just about 5-8 seconds.