DEV Community

Cover image for Introduction to Linux for Developers
Gurkirat Singh
Gurkirat Singh

Posted on

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 organising and customising the OS as per your requirements, no enforcement 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 Way-land.

On the top of X Server, window managers are built to handle different windows to open the application. You see the close, minimise and maximise 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 customisation.

Reading Man Pages - User manual for Linux

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 the 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.

$ apropos ssh cop
btrfs-select-super (8) - overwrite primary superblock with a backup copy
cp (1)               - copy files and directories
cpgr (8)             - copy with locking the given file to the password or group file
cpio (1)             - copy files to and from archives
cppw (8)             - copy with locking the given file to the password or group file
dd (1)               - convert and copy a file
debconf-copydb (1)   - copy a debconf database
git-checkout-index (1) - Copy files from the index to the working tree
git-shell (1)        - Restricted login shell for Git-only SSH access
hpcopy (1)           - copy files from an HFS+ volume
install (1)          - copy files and set attributes
mcopy (1)            - copy MSDOS files to/from Unix
ntfscp (8)           - copy file to an NTFS volume.
objcopy (1)          - copy and translate object files
rcp (1)              - OpenSSH secure file copy
scp (1)              - OpenSSH secure file copy
sg_copy_results (8)  - send SCSI RECEIVE COPY RESULTS command (XCOPY related)
sg_dd (8)            - copy data to and from files and devices, especially SCSI devices
sg_xcopy (8)         - copy data to and from files and devices using SCSI EXTENDED COPY (XCOPY)
sgm_dd (8)           - copy data to and from files and devices, especially SCSI devices
sgp_dd (8)           - copy data to and from files and devices, especially SCSI devicesy
Enter fullscreen mode Exit fullscreen mode

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.

$ apropos -a ssh copy
rcp (1)              - OpenSSH secure file copy
scp (1)              - OpenSSH secure file copy
ssh-copy-id (1)      - use locally available keys to authorise logins on a remote machine
Enter fullscreen mode Exit fullscreen mode

Types of Man Page Categories

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 the man using man man.

The table below shows the section numbers of the manual followed by the types of pages they contain.


       1   Executable programs or shell commands
       2   System calls (functions provided by the kernel)
       3   Library calls (functions within program libraries)
       4   Special files (usually found in /dev)
       5   File formats and conventions, e.g. /etc/passwd
       6   Games
       7   Miscellaneous (including macro packages and conventions),
           e.g. man(7), groff(7)
       8   System administration commands (usually only for root)
       9   Kernel routines [Non standard]
Enter fullscreen mode Exit fullscreen mode

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 the man using man 7 man.

Top comments (1)

Collapse
 
iacillodev profile image
João Iacillo

Loved your article! Looking forward to reading more!