Practicing the Road of Linux: from work to experts

Foreword

 

I still remember in 2004 I just started using Ubuntu 4.04 days, as students, can apply for free Ubuntu installation disk on the site, a few days later, a package arrived containing the CD:

 

 

From then on, I spent a lot of time programming on the Linux platform, from Linux and the Linux community learned a lot, I have to say, by learning Linux, I became a better programmer. 

 

If you are interested in long-term development in the field of computer programming, be sure to learn Linux, but in the end to learn what? How to learn?

 

This is a beginner to learn Linux from scratch guidelines.

 

Why learn Linux?

 

Maybe you've heard Linux is a cool tool for hackers, or Linux more friendly to developers, I think there are three reasons for learning Linux:

 

1. Linux server market dominated

 

Most servers run Linux, programmers especially Web programmers, your program will run on Linux, you need to deploy code on Linux, server maintenance.

 

2. Learning system-level and low-level programming

 

With the advent of the Internet of Things, more related to the underlying programming software, using C / C ++ programming is a basic requirement that such a development usually requires proficient Linux skills. 

 

3. By learning the basics of Linux computer

 

Linux is an open source project, thousands of people around the world in the maintenance of it, there are many excellent books and resources on internal knowledge of Linux, the operating system of learning of great help. 

 

Linux Study Guide

 

Learning Linux is divided into several levels:

1. everyday use

2. The application development, operation and maintenance on Linux

3. The system-level development

4. kernel development

 

Clearly, layers of learning, the more difficult it down.

 

Farmers turn over the code Note:

For ordinary programmers, so that the second layer on the same subject.

For programmers want to become experts in a particular field, we need to reach the third floor.

The last layer may be only a few people, they may be freelancers, hackers, and many of them are employees of large companies.

 

Before beginning an interesting journey, first to recommend one of Linus Torvalds autobiography:

 

 

Daily use

 

These include:

  • How to login, logout 

  • How Networking

  • How to Open a command line window

  • How to use the command line to install / uninstall software

  • How to edit text files

  • How to create, move, delete files

  • How to view compressed files, extract the contents.

 

这个阶段最难的部分就是从图形界面转向命令行。我的建议是就像学游泳那样,把自己扔到水里。不入水永远都学不会游泳。

 

 

所以,一定要在你的PC上安装一个Linux。你可以使用多系统,但是不要尝试虚拟机,因为你很容易就会放弃Linux。

 

到底使用哪个版本的Linux呢?现在可能有十个常见的版本,选择最主流的就好,比如Ubuntu, CentOS等。他们直接的主要区别就是GUI和软件包管理方式。

 

 

Linux上的应用开发

 

Linux上有各种各样的应用开发,例如Web应用,桌面GUI应用,命令行等等。 

 

你可能需要学习Web开发,C/C++/Python或者其他编程语言。

 

在Linux上做开发和在Windows上的体验不同,这里通常没有一个强大的IDE。大部分时候,你的工具链是一系列的小工具,你需要在shell中把他们“连”在一起。

 

 

你需要学习的是:

  • 在一个编辑器中写代码, 常见的编辑器是Vim/Emacs/VSCode

  • 如何编译你的程序

  • 如何从命令行启动你的程序

  • 使用调试器来寻找bug

 

学习一些Shell脚本编程必不可少, 至少你得学到能看懂常见Shell的水平。 

 

现在很多程序员更喜欢Python/Ruby, 但是仍然有很多之前开发的shell脚本需要维护。

 

你需要建立属于你自己的Linux开发环境。把配置文件都记录下来(比如使用Git)。如果你的开发环境搞得很好,编程的效率会有五倍提升。

 

 

《Linux Bible》 and 《Linux命令行大全》会对命令行和开发环境有个非常好的介绍。

 

码农翻身注:在国内,自然是《鸟哥的Linux私房菜》了。

 

在这一阶段花费的学习时间比较长,要保持耐心。 

 

系统级开发

 

如果你的目标是开发那些“底层”的软件,比如存储程序,网络程序,那必须要进入这一层次。 

 

系统级编程和应用层编程大不相同,主要涉及操作系统和网络的东西。

 

你需要学习那些Linux内核对外提供的接口,由于历史和性能的原因,大部分都是C语言的。 

 

使用GDB来调试程序也是必备的技能,你可以参考《Debuging with GDB》,Valgrind 是另外一个有用的内存检查工具。

 

 

《Linux 系统编程》,《Linux系统编程手册》都是非常好的书。

 

网络是系统编程的一个重要编程领域,《Unix网络编程》是你最好的选择。

 

能走到这个阶段可是不简单,只有很少程序员有使用C/C++编程的能力,现代的程序员一般使用更加高级的编程语言例如Python, Ruby ,Java。 

 

技术潮起潮落,但是基础总是不变,系统编程的核心知识能提升你的技能,扩展你的设计能力

 

内核开发

 

成为内核开发人员,那要求可是相当高,能走到这一步,你将是一位受人景仰的英雄人物。 在这个时候,你应该已经学过操作系统的课程了。

 

内核包含很多子模块:内存管理,进程调度,虚拟内存,文件系统,设备管理等。还有很多辅助开发的命令:readelf, nm, ipcs, iostat, objdump, free, chrt, pmap, uptime, top, pidstat, etc.

 

 

Robot Love写的《Linux Kernel Development》是讲述内核开发最好的入门书, 它会给你提供一个很好的内核概览。 

 

中文版名称是《Linux 内核设计与实现》,由陈莉君教授翻译。

 

还有一些内核开发的好书:

《现代操作系统》

《深入理解LINUX内核》

《深入Linux内核架构》

 

切记,Linux内核开发的领域太多,初学者不可能同时涉及所有领域。你的学习策略应该是:

 

1. 获取Linux内核的概览。 

 

一个好方法就是读《Linux 内核设计与实现》,或者去读一下Linux早期版本的源码,因为代码要少很多,这里有很多早期的版本:https://mirrors.edge.kernel.org/pub/linux/kernel/Historic/old-versions/

大约两周的时间就可以完成。

 

码农翻身注:两周的时间太短了!

 

MIT开发的教学操作系统xv6也是一个不错的选择:https://pdos.csail.mit.edu/6.828/2012/xv6.html

 

2 专注在特定子模块 

 

选一个你最感兴趣的模块,试图理解它的设计和细节,参与内核开发的社区,阅读相关的文档,加入Linux的mail list;查看别人的补丁,提交你的补丁。 

 

Linux内核社区有自己的协作风格,你需要学习这些规则。

 

你的第一个被接受的补丁,将会是你的一个里程碑,当你在一个领域内有了足够的知识和技能后,切换到别的领域会变的简单。

 

成为内核开发的大师需要花费很多年时间,快乐地编程吧!

发布了154 篇原创文章 · 获赞 62 · 访问量 23万+

Guess you like

Origin blog.csdn.net/aa120515692/article/details/104261928