What is Linux? It's a free and open-source operating system that's incredibly popular for use in servers and other enterprise computing contexts. Linux is related to the Unix operating system, which makes it a cousin of macOS.
While it's always been a rather geeky choice and not particularly user-friendly, Linux's popularity as a desktop OS has been growing rapidly in the past few years. One of the many reasons people switch to Linux is because it has a reputation for being more secure than other options.
Is this true? Let's look briefly at what Linux is and whether it really is the more secure choice.
Linux actually refers to the OS kernel. It's the core piece of code that lets the operating system control hardware, execute application code, and basically do all the things that you'd expect an OS to do.
This is why you'll hear of the different "distros" of Linux being referred to as Ubuntu Linux, Manjaro Linux, Redhat Linux, or any of the many options out there. They all use the same Linux kernel, but each has its own interface and add-on functionality.
Different distros of Linux modify the operating system for different purposes. Ubuntu Linux is meant to be a direct competitor to Windows and macOS. Redhat Linux is for professional users in an enterprise environment.
Each distro of Linux has its own policies and additional security features. So you can't simply say that any version of Linux is equally secure. Versions meant to be used with sensitive systems and information may be very secure. In contrast, desktop versions may be less secure. However, since the user doesn't have that much use for excessive security, it's better to balance it with usability.
That being said, Linux was designed from the ground up to be more secure than other operating systems. These design-based security measures go a long way to reducing malware and hackers' success using common tactics.
For example, users do not have admin rights by default. Whenever a critical system change is attempted, it has to be elevated with an administrator password. Each user must also have an account, and these are separated from each other.
Viruses and other malware are rare on Linux systems. One of the reasons for this is the same as for macOS. Since Linux has such a small share of the desktop operating system market, it doesn't offer a very enticing target, so it's not worth the effort for malware creators and hackers. If attacks have a generally low success rate, it makes sense to target the most popular operating systems to make it worthwhile.
Also, there's lots of variability in Linux distros. So each piece of malware has an even smaller subsection of the Linux use base. Combine this with Linux's tough fundamental secure design, and there's not much - if any - malware to worry about on Linux systems.
However, this won't always be the case! Linux is constantly growing in popularity. It's also becoming a popular operating system for us in the Internet of Things devices and embedded systems. As Linux finds its way into more and more consumer systems, it makes it worthwhile. Now hackers and malware authors will want to target it, which means it could be less secure in the future.
Apart from a secure design and relative obscurity, Linux is more secure because of its open source nature. Open source software has source code that can be read, compiled, and modified by anyone. That might sound like a source of insecurity, but the opposite is true. The entire Linux community can scrutinize every line of code. This means security experts can patch problems quickly. It also means that it's impossible to hide any spy software in the code.
This leaves no room for backdoors or other loopholes for hackers to exploit. All open source software shares this advantage. However, it's amplified in Linux's case because many independent people are involved with the development and refinement of the code.
The short answer, in the end, is yes. Linux is a highly-secure operating system that's much less vulnerable to attack compared to something like Windows 10. However, that doesn't mean it will make up for poor behavior from users. If users install malicious software or click on compromised links, no amount of good OS design is going to help. So the long answer is that Linux is only as secure as its users allow it to be.