Linux Primer

Linux is a free and open source computer operating system. But what is Linux really? Well, read on!

A Short History

Beginning in 1969 and through the 1970s, Bell Labs developed an operating system known as Unix. This operating system pioneered many of the features and concepts which later became standard in operating systems, such as its approach to file management systems, users and permissions, and threaded processes. Perhaps most important, UNIX was portable; it was written primarily in C, rather than entirely in assembly language. Therefore, it could be ported to almost any general-purpose computer without too much effort.

In the early 1990s, Linus Torvalds began work on an open source alternative to UNIX. This became the Linux kernel. This work overlapped with the work of the GNU project, which began a decade earlier under the leadership of Richard Stallman. Both projects sought to create an operating system which would be fully compatible with UNIX, but which would be free and open source, available to anyone who needed it at no cost.

The result of their overlapping and sometimes combined effort is the Linux operating system, sometimes called the GNU/Linux operating system.

Linux Today

Linux was originally conceived of as an operating system for personal computers, a free and more powerful alternative to Windows, MS-DOS, and Mac OS, all of which were more or less in their infancy in the late 80s. However, due to a number of factors — mostly having to do with the way personal computers are manufactured and marketed to consumers — Linux never became a dominant player in the personal and desktop computing market. Estimates vary and information is a bit hard to determine, but it seems that Linux accounts for about 2% or less of the personal computing operating system market.

However, that fact grossly misrepresents the importance of Linux; it also grossly over represents the importance of desktop computing as a share of global computing power. The fact of the matter is, Linux is the most installed operating system in the world. The vast majority of Web servers are running Linux. Most research oriented supercomputers run Linux. Linux is at the heart of the Android mobile operating system, which means that Linux is on approximately half of all the mobile phones on the planet. While the average consumer-grade desktop computer is running either Mac OS X or Windows, it is actually Linux which powers the vast majority of the world's computers and computing infrastructure.

And, it's a pretty good desktop operating system too. You can find out a whole lot more about the current state of Linux, if you are interested.

Why Use Linux?

So why should you use Linux? Because it is everywhere. In fact, you are probably already using it. If you have a web hosting account, it is almost certainly a Linux hosting account. If you have an Android phone, under the hood is the Linux kernel.

This means that if you are serious about development, especially web development, having an understanding of Linux is essential. You can get away with not knowing it for a while, but if you really want to do anything interesting beyond running a WordPress blog, at some point you're going to need to know a bit more about Linux. That doesn't mean that you need to become a Linux programmer, but you should become more comfortable with using Linux on a day-to-day basis.

And one of the benefits of working with Linux is that there is a certain amount of transparency in the operating system. All the source code is available and then are lots of people around who know the operating system from top to bottom who can help you. In addition, the fact that Linux is free does in fact matter. It matters from an economic standpoint; it is cheaper to run a Linux system then a Windows or Mac OS system. But free does not just refer to cost. Free also refers to freedom. You can do anything you want with the Linux code. It is completely open. This might not mean that much to you at the moment — you probably don't know what to do with the Linux code, or have any reason to exercise the freedoms provided by its license. However, many other people do. By using Linux, you benefit from the network effect of a global community of developers who can inspect and improve the Linux source code. It is because of Linux's openness that Linux is so widely used and trusted.

Distros

As you start getting into Linux, before you even are able to start using it, you'll start seeing a bunch of names — names that you, somehow, are supposed to choose between.

Red Hat. Fedora. Ubuntu. CentOS. Debian.

These are distributions, or distros.

What's a Distro?

A distro is a particular packaging of the Linux kernel, along with modules, drivers, various application software, and any other features that the distro developers want to include. Different distros may have different desktop GUIs, different file manager systems, different levels of support for various hardware peripheries, different package management systems, and so forth.

Many Linux distributions are essentially general-purpose. While they may represent a particular vision of what the computing experience should be like, they are not be intended for any particular type of computing task. On the other hand, there are a great number of purpose-built Linux distributions which are intended to facilitate certain types of problem solving. There are distributions aimed at students and academic workers, distributions targeted for network administrators and Web servers, distributions designed for the special needs of robotics or artificial intelligence or enterprise data management.

Choosing a Distro

When you are first getting started with Linux, the most prudent strategy is to use a general purpose distro. If this is for a desktop computer, you probably want something with a well-developed GUI. You also want something mainstream enough, and with a large enough user and developer base, that most of the things that you want to do on it are well supported.

For a beginner, unless you have some particular reason to choose something else, your best bet is probably one of the more popular, well-supported distros.

  • Top picks:
    • Ubuntu: the most well known, and one of the most popular Linux distro. It is based upon the Debian distribution (see below).
    • Linux Mint: Mint is another Debian-based distribution, and is specifically designed to be easy to use "out of the box," without any complicated set up or learning curve.
    • CentOS: essentially the Community Edition of Red Hat, a commercial Enterprise-grade distribution.
  • Other popular Linux distros:
    • Fedora: CentOS is the free, community edition of Red Hat. Red Hat is the supported, stable edition of Fedora. Fedora is the fast-moving development-oriented version of Red Hat and CentOS. The focus is on new features and new technology.
    • Debian: Debian is one of the first Linux distributions. Ubuntu and many other distros are based on Debian. Debian is a solid, well-supported distribution and is popular both in server and desktop environments.

If you want to use Linux for your own personal reasons, as a tool for development, or a platform for learning, Ubuntu or Linux Mint are probably the way to go. If you work (or hope to work) in a large enterprise environment, and want to use Linux as a platform for serious business applications, you are probably better off with CentOS.

Ubuntu and CentOS (and most of the other popular) distros are "general purpose." If your needs are more particular, you may want to look into one of many special-purpose Linux distributions:

You may also be interested in this list of best Linux distros, by category.

But Don't Worry About It Too Much

If you already have access to a Linux installation — for example, your web hosting account — just use that one. If your best friend is a computer geek, and she has a favorite Linux distribution, just use that one. If you are looking at purchasing a low-cost computer that comes with a particular Linux distribution already installed, just use that one.

In any of these cases, you are likely to end up with an operating system that does everything you want it to.

The only caveat to that is this: if you really need to use a particular piece of software, it is probably wise to see if the developers of the software recommend a particular Linux distribution. Most of the time, that is not the case. However, there are times when a piece of software really only works well, or works best, on a particular distribution.

Where and How to Get/Use Linux

The quickest and easiest way to start trying Linux is to use a live boot CD or thumb drive. This gives you the opportunity to test-drive Linux without much commitment.

Besides trying out Linux, booting from a removable drive has a few other potential purposes:

  • Disk/data recovery. If there is something wrong with your primary disk or operating system, you can boot Linux and then access your original hard drive files. (You won't be able to run applications installed on the primary OS, but you can read and recover data.)
  • No-trace computing. Booting from removable drive lets you make use of a computer's hardware without touching the existing OS or files.

If you decide to become a regular Linux user, you might want to look at more "permanent" ways of having Linux available. For example, most distributions allow you to download an image that you can burn to a DVD and then install Linux just as you would a new edition of Windows or OS X. This is what people normally do. But there are other options.

Virtual Machines

Using a virtual machine is a common way to explore Linux as a serious, regular user — lots of introductory computer science and development classes use Linux in a VM to ensure a common platform for all students.

A virtual machine is exactly what it sounds like: a computer built out of software, running on top of your existing computer. The virtual machine emulates the hardware of a real computer, and requires an operating system just like a "real" computer would. There are a number of vendors and providers of Linux-oriented virtual machines which can run on either Windows or the Mac OS (and also on Linux, incidentally).

Docker

A recent development in virtual machine technology is the emergence of "containerization." To oversimplify things, a container is a very small virtual machine. The current leader in the containerization space is Docker.

Containers were designed primarily as a deployment method. You can develop an application in a container, and then simply copy the entire container to your production server. This simplifies things like dependency management.

If you are primarily interested in Linux as an alternative desktop operating system, you can probably ignore Docker for now. However, if your interest in Linux is primarily because you are trying to enhance your web development skills, particularly in terms of web applications (not just websites), you really should explore containerization technology.

Hosting and Clouds

The vast majority of web hosting accounts from the vast majority of web hosting companies use Linux, and really only a handful of distributions. However, most of them hide the experience of using Linux behind a web hosting control panel. This is fine if all you are trying to do is set up a blog or a shopping cart website. However, if you are attempting to build a web application, you will need more direct access to the Linux operating system.

Generally speaking, this means a virtual private server account, or (more rarely) a dedicated server.

Dual Boot

The boot-from-USB trick is just a portable version of the dual boot method, which is a way of having two (or more) operating systems installed on the same hard drive.

We don't recommend this approach for beginners — there are too many potential pitfalls. But if you feel comfortable digging into your system (and aren't scared by the word "partition"), it's a good way to bring some flexibility to your computing environment.

An Actual Linux Machine of Your Own

Finally, it is possible to build or buy a personal computer just for running Linux.

Switching to Linux

If you are a Mac user, you might find some familiarity with Linux — especially if you use the Terminal. Mac, like Linux, is based on Unix, so there are some similarities, such as how users and permissions are set up. Still, you'll likely find a lot of differences, especially in the desktop UI; nothing really looks like a Mac except a Mac (although some Linux developers have tried hard to mimic it).

There are more difference between Linux and Windows, both in fundamental structure (like how permissions and users work) and simple things like naming conventions.

The Apps Are What Really Matter

For most users, it doesn't matter that much what operating system you are on; it matters what applications you have available.

Many of your favorite proprietary applications are not available on Linux. For example, you can't run Photoshop or Microsoft Office on Linux. Now, there are open source alternatives to many popular apps (try Gimp instead of Photoshop, and LibreOffice instead of MS Office), but you won't always find what you are looking for.

However, if you spend most of your time in a browser, a text editor, or a command line, Linux is going to work just fine for you.

Some Basic Linux Concepts

There are various aspects of using Linux that might seem strange at first to Windows and Mac users. But they aren't that hard to understand.

Users, Groups, Permissions

Linux was built from the ground up to be a multiuser operating system, with the assumption that different users would need to have their personal files segregated and secure from other users.

Users belong to groups. Files and applications have permissions settings that specify who (user and/or group) they belong to, and who can access them (just the owner, all members of the group, or everyone). These access permissions are even specific to certain actions: reading, writing, and executing.

Shell

The heart of the Linux user experience is the shell (or command line or terminal. You may be somewhat familiar with command lines already. There is one available in the Mac OS, and it is more or less analogous with the DOS command prompt available in Windows.

Before the advent of desktop graphical user interfaces, the command line is all there was. In order to get a computer to do something, you entered commands at the command line. Icon based GUIs, like you have in Windows or Mac, cover over the ability to issue commands directly to the operating system. Certain commands — such as opening a document or running an application — are easily represented in the GUI. Others — such as performing complex operations on a directory tree, or deleting all files that contain a certain set of letters in the file — are either impossible or very difficult in a graphical environment.

The terminal can be a little intimidating for new Linux users. It's just a blank screen, and you can type anything into it. However, once you get used to using the terminal, and start to harness the power that it provides, you'll wonder how anyone gets anything done without it.

Getting and Installing software

There are several different ways to get and install software on Linux. How you install applications will depend on your particular distribution as well as on the particular software you are trying to install.

The best way to install a piece of software is to use your distribution's software repository. This is moderately analogous to an App Store. It provides a single, relatively easy place from which to get (more or less) verified software packages. Unfortunately, not every Linux distro maintains a software repo (the bigs ones do, though). Moreover, not all the software you want will be available that way.

A lot of proprietary software (like Skype or Steam) is not available from a package manager or software repo. In this case, the application's website will usually provide a handful of Linux application installer packages. You won't always find your distro represented in the list of package options, so it is helpful to know other major distributions that your distro is similar to or based on. (For example, Red Hat, Fedora, and CentOS are very similar, so an installer package built for one will likely work for the other two.)

You can also compile and install new software from source code. You won't have to do this for most mature and stable applications (because they are usually available in easier formats), but if you want to try out beta builds and release candidates for software that is still in development, you'll need to learn how to do this.

Additional Resources

Linux Cheat Sheets

And one more thing…

This guide wouldn't be complete without a quick mention of Raspberry Pi, Arduino, and many other microcontrollers. Besides servers, desktops, and phones, Linux is usually the operating system that powers these devices, which can be used to build all sorts of devices, toys, sensors, and robotics projects. (You can even build a supercomputer.)

Linux really is everywhere.


Further Reading and Resources

We have more guides, tutorials, and infographics related to web hosting:

The Ultimate List of Webmaster Tools A-Z

Linux is still by far the operating system of choice for powering web servers. So if you find yourself running Linux (especially Gentoo), you will probably find yourself managing a web server. The Ultimate List of Webmaster Tools A-Z will provide you with a lot of help in doing your work.