How to Learn Linux? (from Zero to Hero)
Tags: linux, beginners, tutorial, ubuntu
Published: 2019-10-23 05:43:06

Original Post: [https://www.coderscat.com/how-to-learn-linux](https://www.coderscat.com/how-to-learn-linux)

## Foreword

I still remember the days when I started using Linux with Ubuntu 4.04 in 2004, students apply for installation CD on Ubuntu’s website, then we will receive a package which contains CD in several days later.

![ubuntu cd](https://www.coderscat.com/wp-content/uploads/2019/10/2019_09_30_learn-linux.org_20191022_222735.png)



How nice! Since then, I spend most of the programming time on the Linux platform and learned much from Linux and the community. I must say, with learning Linux, I become a better programmer.

I always suggest beginner start with Linux when learning to program. But how to learn it, what exactly do we want to learn? This is a guide for the beginner to learn Linux from scratch.

## Why learn Linux?

Maybe you have heard that Linux is cooler tools for hackers, or that Linux is more developer-friendly. In my opinion, there are three key reasons for learning Linux.

1. The first truth is: Linux has dominated the server market, most computing servers are run Linux. As a developer, especially for Web development, you need to write code run on Linux, deploy code on Linux, and you maybe need to maintain a Linux server.
2. Learn system programming API and low-level programming. With the trend of [IoT](https://en.wikipedia.org/wiki/Internet_of_things), there is more software involving low-level programming, coding with standard C/C++ is a requirement for this kind of task. This kind of development usually needs proficient skills with Linux.
3. Learn system fundamentals and internals. Linux is an open-source project, maintained by thousands of developers around the world. There are many good books and resources about Linux internals, which will help you much with the learning operation system.

## Linux learn guide

Different target should follow different learning path, we could roughly divide the target into several levels:

- Daily usage
- Application development on Linux, operation, and maintenance
- System development
- Kernel development

You should learn according to this path, every previous step is a precondition to the next. If you don’t know how to use Linux as a daily OS, you can not use it as a development OS, and of course, dig into internals will be much harder.

![learn linux cd](https://www.coderscat.com/wp-content/uploads/2019/10/2019_09_30_learn-linux.org_20191022_224622.png)



Find Linus’s book: [Just for Fun: The Story of an Accidental Revolutionary](https://amzn.to/2PaxI7m), let’s begin the funny journey.

## Daily usage

Daily usage includes:

```
How to login and logout
How to connect to the Internet
How to open the command line
How to install uninstall software using the command line
How to edit text
How to create, move, delete files
How to view the contents of a file and extract the file
......
```

The hardest part of this stage is the transition from the graphical interface to the command line. My suggestion is like learning swimming, try to throw yourself into the water, **you will never learn how to swim if you don’t get into the water**.

![learn linux cd](https://www.coderscat.com/wp-content/uploads/2019/10/2019_09_30_learn-linux.org_20191022_223135.png)



So, please just try to install a Linux distribution on your PC.

You can install multiple operating systems on a PC. Don’t even try to use Linux on virtual machines, this will give you a chance to hold back from daily usage on Linux.

Which Linux distribution should be should beginner to use?

Well, there are about 10 commonly used Linux distribution, choose any one of the top 5 will be OK. Choose mainstream distributions, such as Ubuntu, Centos, etc. It is easier to solve problems when encountering problems.

There mainly differences among them are graphical interface and package management.

## Application Development on Linux

There is various kind of application development, including Web application, desktop GUI application, command line or application for various tasks and computing.

You maybe need to learn Web development, C/C++/Python or any other programming languages.

Developing on Linux is a different experience compared with Windows. Unlike on Windows, developers usually have an IDE for development.

![learn linux cd](https://www.coderscat.com/wp-content/uploads/2019/10/2019_09_30_learn-linux.org_20191022_223441.png)



Most of the time, your toolchain is a set of various little tools, and you need to run them and combine them in a shell.

You need to learn:

- How to write a code in an editor, commonly editor should be Vim/Emacs and VScode.
- How to compile or build your program
- How to launch your program from the command line
- How to locate bugs, run a program with debugger

You should learn some shell scripts programming, at least to the level that you could understand most common shell scripts. Currently, most developer prefers to use Python/Ruby to replace shell scripts, but there are still many existing scripts.

Try to set up your favorite development environment on Linux, here are [some tools](https://dev.to/jonathanbossenger/my-2019-web-development-setup-4bb7) may be used. Remember to keep tracking of your configurations, I use Git to for configuration version control.

This stage, of course, involve much other specific domain knowledge, this depends on your choose technology and framework, for the most modern programming language, such as Ruby/Python/Rust, it will be easier to set up the environment.

![ubuntu cd](https://www.coderscat.com/wp-content/uploads/2019/10/2019_09_30_learn-linux.org_20191022_223748.png)



If you set up your environment properly, your coding productivity will x5 than before.

[Linux Bible](https://amzn.to/2P77J0j) and [The Linux Command Line: A Complete Introduction](https://amzn.to/2W7COCz) will give you good introduction for the command line and other preparations.

This stage is a long learning process, keep patience.

## System development

If your task is to develop some low-level software, such as storage or networking application, you need to learn Linux system development.

System programming is different from most application development, system programming involving more OS or networking stuff. You need to know the details most commonly used [Linux Kernel Interface](https://en.wikipedia.org/wiki/Linux_kernel_interfaces). For historical and performance reasons, system development usually needs to know C/C++, system API provided in C.

The skill of gdb debugging is a need, you could refer to the [Debugging with GDB](https://amzn.to/2P8LEyz), and [Valgrind](http://valgrind.org/) is another useful memory checking tool.

![ubuntu cd](https://www.coderscat.com/wp-content/uploads/2019/10/linux-system-programming.jpg)



[Linux System Programming: Talking Directly to the Kernel and C Library](https://amzn.to/2qBjVML)

[The Linux Programming Interface: A Linux and UNIX System Programming Handbook](https://amzn.to/33TVtod)

are both good resources for the Linux programming interface.

Networking is another important field for system programming, [Unix Network Programming](https://amzn.to/33T7xWJ) will be your best choice.

This is also not an easy stage, less programmer has the ability to coding in C/C++, it’s a trend that the new generation prefers to modern and high-level programming languages, such as Rust, Python.

Remember the fundamentals are the same, the core knowledge of system programming will sharpen your skills, [expand your design ability](https://www.coderscat.com/to-be-a-programmer).

## Kernel development

The requirements of Kernel’s development are relatively high. You will be a HERO after finish this. At this time, you should have studied the courses of the operating system.

The kernel contains submodules such as memory management, process scheduling, virtual memory, file system, device drivers, etc. Of course, more related commands are also necessary for development, such as readelf, nm, ipcs, iostat, objdump, free, chrt, pmap, uptime, top, pidstat, etc.

![linux-kernel-map](https://www.coderscat.com/wp-content/uploads/2019/10/linux-kernel-map.png)



Robot Love’s [Linux Kernel Development](https://amzn.to/33VGfiD) is the best introduction book for Kernel development, it will give you a good big picture of the kernel.

Another good book list for Kernel development:

[Modern Operating System](https://amzn.to/2PaJmz8)

[Understanding the Linux Kernel](https://amzn.to/2P7Et9S)

[Professional Linux Kernel Architecture](https://amzn.to/2JevNL3)

Remember, because there are too many fields in Kernel development, it’s almost impossible for beginners to start all the fields. Your learning strategy should:

1. Get the big picture of Linux Kernel, a good method is read Robot Love’s book, an alternative strategy is to learn the [old version of Linux](https://mirrors.edge.kernel.org/pub/linux/kernel/Historic/old-versions/) because of the codebase is much smaller, you could spend about 2 weeks to finish it. [xv6](https://pdos.csail.mit.edu/6.828/2012/xv6.html) is another good choose, with good [reading materials](https://pdos.csail.mit.edu/6.828/2019/reference.html).
2. Focus one specific submodule, choose one submodule which most interested you, and try to understand the details and design of it. Try to involve the Kernel development community, read the [document](https://www.kernel.org/doc/html/v4.16/process/howto.html), join [Linux mail list](https://lkml.org/), review other’s patch and try to submit your patch to Kernel. Linux Kernel community has its collaboration style, you need to learn the rules. It will be a milestone after you submitted the first patch. If you have enough knowledge and skills for one subdomain, it will be much easier to transfer to another one.

It will cost many years to be a master of Kernel programming, happy hacking and have fun.