Introduction to Linux for Developers
Hello friends! In this post, I will try to explain to you why I prefer Linux based OS for development. Not only because it's free, but also you have full control over organizing and customizing the OS as per your requirements, no enforcements from the vendor's end. I will try to explain the working of Linux in brief and try to gain your trust in switching to any Linux based OS.
If you are coming from Windows OS, in the starting, it would be hard for you to grasp the knowledge because till now in a closed source operating system everything is pre-built for you. All you need to do is give a certain partition configuration and install it.
Why Linux for Development
I have seen many developers misunderstand Linux as an operating system and then get puzzled by different distros. Guys hold your pace! Linux is just a kernel, which means it's the core that allows bridging the gap between hardware and the software world. When you have a kernel with a bunch of software that is commonly used in our daily lives, we call it an Operating System.
Yes but, then why do you need external drivers for communicating new hardware devices? Well, long story short, new devices are coming into the market every day and it's kinda hard for Linux developers to maintain a repository for all of them. Kernel focuses on managing the crucial resources like CPU execution time, memory, disk and networking in the OS.
Is it really a synonym of CLI
Yeah when I was a beginner in OS and encountered my first ever SSH connection back in days while learning Linux in my college, I also made this perception that Linux is all about handling CLI like old school in DOS. Well, this is not true. In Linux, there are several third-party software you can install and start the GUI. It's the choice of the user whether to work like on a terminal or a GUI. In this section, I will guide you about different packages that build up the Graphical Interface on top of Linux Kernel.
On the ground level, it's a minimal server used for handling the communication between GUI elements like mouse and keyboard by defining a set of protocols for the same. One of the most common examples of this is the X11 server or the Wayland.
On the top of X Server, window managers are built to handle different windows to open the application. You see the close, minimize and maximize buttons and think how a window is created to show the content of a particular process in it, well which is all handled by these window managers. Apart from basic window management, they offer additional services out of the box like tabs, visual effects and multiple desktops. An example of this could be KWin and Mutter.
You might have heard people often debating about KDE vs Gnome, etc. Well, those are examples of what we call Desktop Environments. They are built on top of window managers and managed by specific communities. It consists of all the magical things you see in the GUI, like different panels, widgets, drag-and-drop features of files and similar contents, the configuration of services via GUI based inputs controls like switches and knobs.
These all 3 components – X Window System + Window Manager + Desktop Environment work in harmony to provide a full graphical experience in the Linux based distros. The cool thing is you have full autonomy to decide which of these to use and with what type of customizations.
Reading the Manual Pages
In this journey, documentation is your best friend. You should be able to understand a lot of things from the documentation provided by the project maintainers to build, customize and troubleshoot them. In Linux, you can use man pages for that using man
command.
These manual pages are used to get help regarding any command or library function shipped with the packages. See man man
for more information. Sometimes it's hard to remember the function name or the exact thing to look but we have an idea of what we are looking for. So in that case you can use apropos
the command followed by the text to find the topic and then later use the man page for it.
For example, I forgot a command to get the memory dump of the program. So in this case I can use apropos ssh copy
command and then it will search from the man page index locally and get the appropriate topic with a brief description about it to differentiate the usage among others
Now I have trimmed a lot of output here, but you can add some strict constraints like only getting the entries if it has all the keywords otherwise ignore them. Well you will have to add -a
switch after the apropos command
Different Types of Man Pages
As you can see there are different numbers assigned to similar or different entries in the index. What does that mean? Well, there are about 8 different categories of information in Linux and each command or same function are logically grouped into them. The following is copied from the man page of man using man man
.
Most of the time you will deal with 1, 2, 4, and 8 sections only. Others are helpful when you are into Linux system development.
You can get the information of different sections either from apropos search or "SEE ALSO" section on the man page of a specific entry. For example, while reading the man's man page, I found there is one more entry for the same man(7)
.
By default it will try to look into the very first category, you can provide additional argument before the name that specifies a particular category to look into. If the entry does not exist in the man database, it will return an error otherwise open the man page for you. For example, in this case, if you can open the 7th category man page of man using man 7 man
.