Learning to use linux
How to Learn Linux? (from Zero to Hero), a guide for learning 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. We will receive a package which contains a CD several days later.
How nice! Since then, I spent 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? Here 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 critical reasons for learning Linux.
- The first truth is: Linux has dominated the server market, most computing servers are running 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.
- Learn system programming API and low-level programming. With the trend of IoT, 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.
- 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 targets should follow different learning paths. We could roughly divide the goal into several levels:
- Daily usage
- Application development on Linux, operation, and maintenance
- System development
- Kernel development 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. Find Linus’s book: Just for Fun: The Story of an Accidental Revolutionary, let’s begin the funny journey.
Daily usage
- How to login and logout
- How to connect to the Internet
- How to open the command line
- How to install and 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 thecommand 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**. 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? There are about ten commonly used Linux distributions. Anyone 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 main differences among them are graphical interface and package management.
Application Development on Linux
There are various kinds of application development, including Web application, desktop GUI application, command line, or application for multiple 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.
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.
- 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 simple 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 development environment on Linux, here are some tools may be used. Remember to keep tracking of your configurations. I use Git 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. If you set up your environment properly, your coding productivity will x5 than before. Linux Bible and The Linux Command Line: A Complete Introduction 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. 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, and Valgrind is another useful memory checking tool.
Networking is another relevant field for system programming, Unix Network Programming 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.
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.
Robot Love’s Linux Kernel Development 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:
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:
- Get the big picture of Linux Kernel. A good method is to read Robot Love’s book. An alternative strategy is to learn the old version of Linux because the codebase is much smaller, you could spend about two weeks to finish it. xv6 is another good choice, with good reading materials.
- 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, join Linux mail list, review other’s patch and try to submit yours to Kernel. Linux Kernel community has its collaboration style. You need to learn the rules. It will be a milestone when your first patch is accepted. 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.
Join my Email List for more insights, It’s Free!😋