Deep Dive Articles

The Best Way to Learn a New Programming Language from Scratch - How I Approach and Learn Any Programming Language Efficiently

Preface: The following article is based on my experiences and opinions on learning programming languages. I have been learning about computers in-depth and find learning languages with specific purposes useful. For example, Python was for beginning, C is for memory management and Rust is for learning to write memory-safe code in my case. This time, I started learning Golang which is known for its simple syntax and powerful performance, and widely known for its awesome concurrency.

Why More is Not Always Good in Terms of Software - Words on Cross Platform Utilities, Bash-ism, and POSIX Compliance.

Preface: This article is about my views on software compliance and cross-platform support, and reflects my opinions and experience with the subject. Your experience and opinions may vary, which I respect. What I am Specifically Talking About? I am going to talk about the issues caused by non-compliant software and why more features are not always good, especially in the case of the upgrade of tools on a single platform.

Why I Shifted From Arch Linux to Debian Linux?

Preface: The following article is based on my personal experience with Arch Linux and Debian Linux. While I appreciate both distributions for their unique strengths and different use cases, the information provided reflects my own opinions and experiences. Your experiences may vary. What was I going for Initially? Bit of my Story as a Beginner Linux User When I started using Linux, I was going through security stuff and learning computer security when I was in my High School.

Tmux is the Ultimate Choice for Power Users - An Awesome Terminal Multiplexer for Managing Persistent Sessions

What is Tmux? Tmux is a Terminal Multiplexer Application for Linux and MacOS for managing terminal sessions and Windows. It is to be mentioned that Tmux is not a terminal emulator, instead, it’s a terminal application, a binary that allows you to stay productive over your terminal. It doesn’t matter which terminal emulator you are using (although I recommend the Suckless Terminal). The functionality of managing Windows and the session doesn’t happen on the desktop GUI side but on the terminal session, you are working with.

The Concept of RSS Feed - A Reliable Way for Publishers and Subscribers Model

Preface: I have been looking for simple solutions in nearly everything related to computing. A lot of software designed these days is not designed per your requirements but as per companies’ profit. Hence, most of these solutions end up sucking your time and energy and need to be replaced by more optimised solutions that would boost your productivity in the right way. RSS Feed is something that I found after searching for solutions related to subscribing to websites or creators without sucking much resources and design that is reliable to the user itself.

Breaking RSA Encryption on Hardware Devices with Side Channel Power Analysis — Leaking the Private Key by Exploiting Square-Multiply Algorithm

Preface: This article is about leaking the private key from hardware devices that implement RSA encryption which is part of hardware hacking. The author is not responsible for any damage caused by the given information. It is recommended to be careful while performing these attacks as they can damage the hardware or even destroy it. All the information provided here is for educational purposes. There are no such prerequisites for understanding the theory, although knowledge about modular arithmetic, basics of encryption mathematics, basic electronics, etc.

Serious Reconnaissance with Unmanned Aerial Vehicles — Mapping Out Devices in an Area with Drones

Introduction: The following content is for educational purposes and for hackers living in basements knowing enough ethics. The author is not responsible for any damage caused by the knowledge provided here and does not support anything like that. It’s essential to check out the rules in the area of reconnaissance about the tactics provided here and the use of materials (unless and until there is any apocalypse and a solid recon is required).

The Fundamentals of Hardware Hacking — Breaking and Reverse Engineering Smart IoT Devices

Disclaimer — This is an introductory article about Hardware Hacking and Security of IoT Devices. None of the mentioned information or techniques are intended for any illegal purposes and the author is not responsible for any damage. It’s advisable to experiment on devices that you own or have explicit permission to do so. Rest of all, hardware hacking is fun! The Beauty of Electronic Devices In the ever-growing world of smart devices and the connectivity of things to the internet, life has become more convenient than ever.

Setting Up a Remote Git Server — A Simple and Concise Step-by-Step Guide to Host a Private Git Server

Preface: This is a concise and simple guide to hosting a remote git server. I have been researching this topic for a while and came up with the idea of writing an article with a step-by-step guide for hosting a private git server. Covering all the aspects of git is not possible in a single article, so it’s assumed that the reader has prior knowledge of git and version control.

The Nature of Linux Kernel Development — Difference Between Rules of Kernel Level and User-Space Application Level

Preface: This article is intended to explain a clear distinction between the core principles of Linux Kernel Development and User-Application Level Development. The provided information is based on my research on Kernel Development through various sources and I have tried to make it as accurate as possible. Efforts have been made to explain it as simply and concisely as possible. Introduction to the Nature of Linux Kernel Linux Kernel is the abstraction layer between the Operating System and the Hardware in the system.

Linux Process Scheduling — The Reason your Linux System Processes so Efficiently (Kernel Perspective)

Preface: I was going through the book “Linux Kernel Development” by Robert Love, one of the best books I have referred to for low-level stuff and understanding the workings of Linux. I study this book with intensity, simplify the concepts and write it down here so that the readers can get a straightforward description and all they need to know about the topic. Covering the whole Linux Process Scheduling is not possible and is not the goal of this article.

Linux Processes — A Kernel’s Perspective Explained with Clarity and Simplicity

Preface: I have been going through the book “Linux Kernel Development” by Robert Love which I highly recommend for understanding the Linux Kernel in depth. I decided to write this article to explain “Linux Processes” simply and concisely. The topic itself is broad and is not explained into the deepest of it, but essential for Linux Administrators, Developers and even Linux users to appreciate the beauty of the Kernel they make use of every day.

NGINX for Deploying Next.js Application on AWS EC2 with AWS ELB — Control and Stability of Deployments

I was looking for an article like this a few days ago, which I didn’t find at that time, so I did the deployment on my own and came up with this article to prevent other developers from saving those efforts and focusing on development. I am not explaining every single step and have provided links for references. I prefer manual deployment of applications over automated (and even serverless) methods. Although they are convenient and require less effort by the developers, they are bound to the providers and offer less control over the underlying system.

Configuring and Building the Linux Kernel — Absolute Guide to Compiling Your Kernel

Linux Kernel is an Open-Source Software and the user is free to modify and customise it as per the requirements. The modification of the Kernel requires a deep understanding of the working of the Kernel, although patches are available to make the Kernel optimised for specific hardware. Linux Kernel Source Code has various options to configure the drivers, modules, preferences on hardware options, etc. This part can be studied by the user and is pretty much easy to work with.

The Elegance of the Linux Kernel — A Concise History of Unix and the Creation of the Linux Kernel

Introduction and Context I was going through the book “Linux Kernel Development” by Robert Love, an absolute guide to getting started with Linux Kernel Development and a highly recommended book for understanding the core of the Linux Kernel. Linux Kernel has been one of the most important software ever written and is even considered one of the biggest projects ever undertaken by a single person. The idea of the Linux Kernel was initiated by Linus Torvalds, a student from the University of Helsinki and is maintained by him to date (while writing this article).

Linux Shell Scripting — A Suckless and Concise Guide to the Command-line of Linux

Prior Statements: This is a concise guide on the Linux Shell Scripting while consolidating all the facts about the Linux Shell for quick developer’s reference while using Linux. I am referencing the Bash (Bourne-Again Shell) which is the default shell for Linux-based systems. I will also be providing references and external links to dive into depth and not fill the article with too much explanation about a single topic which is not universally required by all the readers.

Suckless Utilities for Arch Linux — The Most Minimal Way Run a Computer

Suckless utilities have been my favourite at this time and kind of essentials for my use of the computer. I have been using Arch Linux for a fair amount of time now and I started using it with XFCE for few weeks. I would appreciate the XFCE desktop environment for it’s smoothness and light-weight nature with works really fine when newly shifting on Arch Linux. But then I learnt the suckless ecosystem and eventually shifted to it as my full-time environment.

Installing Pacman in Arch Linux — When You Blow it Up

Let me suckless and divide the article into two parts: My story how I blew up Pacman Package Manager How to reinstall the Pacman Package Manager If you only care about the second part, skip the first one. The Scenario — Blow it Up I was trying to install the pacman game from the Internet to get it running on my Arch Linux Terminal (I use Suckless Terminal BTW). When I got it installed and played it, it was super awesome.

Boot Process of Computers — A Learner’s Perspective Of Exploring the Depth of Computers

Prior Clarifications: Here, I will be providing a philosophical explanation about the bootloaders and understanding them in a simple and as minimal way as possible. This is not supposed to be a manual for bootloader or provide any advice for experimenting over your live system. It’s my journey to understand computers (one of the most complex creations of mankind) and I will be stating my thoughts. Take it with a pinch of salt.

Networking Fundamentals for Linux Administrators — A Suckless and Concise Explanation

Statistics are clear on the fact that 96.3% (while writing this article) of the servers use Linux as their Operating System which is no doubt what every other Linux user on this Earth expects. I believe that the Linux Administrator has to take the shot about the configuration of Networking in Linux Based Server. Some of the underlying concepts remain the same for any other distros but it is mainly intended for Linux.

Operating Systems and Low-Level Access to the Hardware — Why should you learn it?

Today, I completed the whole read of the book “Linux Kernel in a Nutshell” by Greg Kroah-Hartman and I highly recommend that you go through it if you want to understand how to build your custom configuration of Linux Kernel and all you need to know about all the nuts and bolts. It’s always great to have such handbooks around the desk. This blog is about why it’s so awesome to look into the operating system you are using with your hardware and why have a grasp on the Low-Level aspects of a computer.

Arch Linux Custom Builds — Freedom of the Operating System

While writing this blog, I was reading the book “Linux Kernel in a Nutshell” by Greg Kroab-Hartman and as far as the pages of the book are concerned, it seems to be a two-day read (this is a handbook so reading it once and having around the desk is super useful). By the way, the author has the book left open for download http://www.kroah.com/lkn/ so check that out if you want to follow up.

Bypassing the Linux Login to access the files (with Physical Access), even the root!

Imagine being away from the computer for a couple of minutes and getting to know that the system has been compromised and a backdoor has been installed into the system. “The system was locked?” doesn’t matter, without the bios security implementation (which most probably would not be implemented), all the files can be recovered without any login made to the Login Screen. This goes with the story of me trying to get my Wi-Fi troubleshooting in Arch Linux where I was trying to upgrade the Kernel of my System to get the Wi-Fi working properly (as mentioned in the previous blog.

Tmux is the Ultimate Choice for Power Users - An Awesome Terminal Multiplexer for Managing Persistent Sessions

Planted May 27, 2024

What is Tmux?

Tmux is a Terminal Multiplexer Application for Linux and MacOS for managing terminal sessions and Windows. It is to be mentioned that Tmux is not a terminal emulator, instead, it’s a terminal application, a binary that allows you to stay productive over your terminal. It doesn’t matter which terminal emulator you are using (although I recommend the Suckless Terminal). The functionality of managing Windows and the session doesn’t happen on the desktop GUI side but on the terminal session, you are working with.

Tmux is Free and Open Source Software and its source code is available at its Official GitHub Repository: https://github.com/tmux/tmux

Readers of my articles know how much I love Open Source and Free Software and this one is one of my favourite terminal applications.

Why do You Need Tmux?

One thing about Tmux that I would like to mention is that Tmux is highly productive and you just need some amount of patience to learn it.

Terminal Emulators are great, they can manage a lot of things like splitting panes and tabs, which Tmux also does by default. For instance, I use the Suckless Terminal with DWM (Dynamic Window Manager) which is a tiling window manager that allows me to have screen layout split into patterns that I prefer depending upon my work and have multiple workspaces mimicking as tabs on my system for the terminal emulators. In the past, I used to work with Terminator which is a graphical-based terminal emulator and had a decent amount of functionalities where windows were split and tabs were created inside one whole application. The GNOME terminal also supports the same and gets these basic jobs done.

Tmux on the other hand works in a different way. Tmux runs on the terminal emulator and performs these operations on the TUI itself. So it doesn’t matter which terminal application you use, Tmux is going to work in the same way. When you split the screen, it’s not the GUI of the Terminal (like in GNOME terminals) where it’s going to split graphically. It would be splitting the terminal space in that terminal session.

It might sound a bit confusing in the beginning but is easy when you use it. Let me put it like a story:

When you open a terminal emulator on a desktop environment, it runs as a GUI and starts a terminal session with the underlying operating system. All the stuff you work in here is gone into the terminal session and is confined inside it.

When you split the terminal, a new session is created which is different from the session it was in that prompt. It’s a “different terminal session”. The same goes with the tabs, when you open a new tab, a new terminal session is spawned.

In the case of Tmux, when you open a GUI terminal, you get that one terminal session to work on. When you start a Tmux session inside it, all the tabs and windows are packed into that tmux session which is running on the same terminal session. Hence, you would be controlling a lot of prompts inside the same terminal session. All the creation of tabs and windows would be happening inside the tmux session which was inside that terminal session.

Now if somehow your terminal crashes or gets closed by mistake, the terminal session is lost and all the history or temporary environment variables disappear. But if you were working in the Tmux session, that Tmux session can be restored in any other terminal session as well.

You can have multiple terminal sessions running and you can access the Tmux session from all of them at once. So even if one of the terminal sessions is closed, the underlying Tmux session doesn’t stop and can be restored.

Tmux for Linux Administration

Linux Administrators connect to servers remotely, commonly via SSH (Secure Shell). Working with a shell that is connected to a server with a network can be fragile. And you get disconnected with the shell, all the work that wasn’t saved or history can get destroyed. Tmux provides a persistent session here with a lot of other functionalities.

When you log into a server, if you start a Tmux Session and start working on it, then that session is stored in the server while it’s running, even if the SSH is logged out. And you are allowed to create multiple Tmux sessions if you want! All those sessions would be restored even if get accidentally disconnected from the server, saving your precious work done on that session.

Furthermore, when you spilt screens in terminal emulators, it happens on the client side. So when you are connected to a server and you need to do multiple things on different panes, you need to log in again on that split terminal (remember, the split terminal is a new terminal session, in this case on the client side only). But with Tmux when you split the screen, it’s split on the server side and you would see a split terminal on the client side in the same session of the terminal, without any interaction with the client’s terminal. The same goes with tabs, they are created on the server side with Tmux. And even when you disconnect from the server, all the Tmux sessions, tabs and windows are saved!

This makes Tmux one of the best tools for Linux Administration purposes and when you are working remotely with servers.

Tmux for Personal Computers

As good as remote servers, Tmux works like a charm with productive setups on your personal computers. All the good things listed above are as important in Personal Computers too. Creating tabs, and sessions and splitting windows with persistent and redundant sessions come in handy while immersing in the work.

When you are working with the terminal all the time (like Vim users), persistent sessions are important in case of disruptions like the terminal crashing or accidentally closing the terminal application. Everything in Tmux is stored as it was before it was detached.

And learning Tmux has an advantage too. Tmux doesn’t care which terminal emulator has been used. So even if you are working on different terminal emulators, say you are a Kitty user shifted to Alacritty, the binding of Tmux would be as per your configurations and would not change. And when you are good with Tmux, your server administration skills will boost up too. When you are conceptually clear with Tmux and have the habits of key bindings, the terminal session on the servers will be as productive as it is on your personal computers.

I recommend creating an automated script for these cases. For instance, if you need to constantly monitor CPU usage and Memory utilisation on the server while you work, Tmux widgets can be useful to do so. So you can develop a script, which when run on the remote server, installs and configures Tmux in that way in one command.

Installing Tmux

Installing Tmux for different depending upon the Operating System, few of them are listed below (you can install it with your package manager):

Debain Based Distros

sudo apt update
sudo apt install tmux

Red Hat-based Distros

sudo yum install tmux

Fedora Based Distros

sudo dnf install tmux

Arch Linux Based Distros

sudo pacman -S tmux

OpenSUSE

sudo zypper install tmux

Gentoo Linux

emerge tmux

MacOS

brew install tmux

Installing from Source (Unix Like Distros)

Installing Dependencies

(Listing for Debain, same can be done with different package managers on different distros)

sudo apt update
sudo apt install -y build-essential libevent-dev libncurses-dev

Downloading the Source Code

wget https://github.com/tmux/tmux/releases/download/3.3a/tmux-3.3a.tar.gz
tar -xvzf tmux-3.3a.tar.gz
cd tmux-3.3a

Compile and Install

./configure
make
sudo make install

Refer the Official Tmux Wiki for more information or Troubleshooting: https://github.com/tmux/tmux/wiki

Tmux Plugins - The Tmux Plugin Manager

Tmux supports a variety of plugins, which is made easy by the TPM (Tmux Plugin Manager) which allows you to manage your tmux plugins in a better way. Installing TPM is simple, use the following command to download TPM and just add the following line to your tmux.conf file (if it doesn’t exist, create one).

git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
set -g @plugin 'tmux-plugins/tpm'

# Plugins here 

# At the end
run '~/.tmux/plugins/tpm/tpm'

Finally, run:

tmux source ~/.tmux.conf

After this, you are ready to install any plugin of your choice. A few plugins that I use will be listed in the next section where you can understand how to install plugins via TPM.

Example of Tmux Usage - How I Use it and My Config Files

I use Tmux on my main Debian Machine and my Macbook all the time. My usual workspace is Tmux + NeoVim for both of my machines (and Tmux looks like a tiling window manager, just like DWM). Although, I use some plugins to make my Tmux beautiful and add some more features. Also, I use my custom bindings as per my requirements.

tmux

This is my Tmux configuration file:

unbind r 
bind r source-file ~/.tmux.conf

set -g prefix C-s 
set -g status-position top

set -g status-position top

# Vim Bindings 
setw -g mode-keys vi 
bind-key h select-pane -L 
bind-key j select-pane -D 
bind-key k select-pane -U 
bind-key l select-pane -R

# List of plugins 
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'dracula/tmux'

set -g @dracula-plugins "cpu-usage ram-usage battery time"
set -g @dracula-show-powerline true
set -g @dracula-show-left-icon window
set -g @dracula-battery-label "Battery"
set -g @dracula-git-show-current-symbol ✓
set -g @dracula-time-format "%T"

# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'

I am using the dracula tmux colorscheme which is dark with optimal contrast to make tmux took awesome. Dracula supports a lot of other features like monitoring various things, like for me, the CPU, Memory and Battery (for Laptop) and a few other configurations.

Dracula Theme Official Page: https://draculatheme.com/tmux

Configuring Dracula is super easy and is well documented on the Official Page.

Here, I am using NeoVim on MacOS and I will be posting articles on NeoVim in the future about how to configure it and use it for maximum developer productivity.