Linux Articles

Page 23 of 134

Monitoring context switches in Linux

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 3K+ Views

Context switching is an essential aspect of modern operating systems that enables them to efficiently manage resources. Context switching is the process of switching from one process to another in a multi-tasking environment. The operating system does this by saving the state of the current process and loading the state of the next process. Monitoring context switches in Linux is a crucial task for system administrators, developers, and users who want to optimize performance of their systems. Understanding Context Switching in Linux Context switching occurs when the operating system switches between multiple processes to give the illusion of ...

Read More

How to swap two files in Linux command line?

Vishesh Kumar
Vishesh Kumar
Updated on 17-Mar-2026 2K+ Views

As system administrators or DevOps professionals, we often need to exchange file contents. For example, you might have a backup file /etc/passwd.backup that you want to restore to /etc/passwd, while preserving the current content by moving it to the backup file. This operation is called file swapping − exchanging the actual content of two files, not their locations. When we talk about swapping two files on Linux, we mean exchanging their content while keeping their names and locations unchanged. This tutorial demonstrates practical methods to accomplish this task using command line tools. Example Files Setup Let's create ...

Read More

Cross compile Static Library from Linux for windows

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 2K+ Views

When developing software, there is a high chance that software might be used in various operating systems. Therefore, it is important to build software in a cross-platform manner to ensure compatibility with multiple operating systems. In this article, we will focus on cross-compiling static libraries from Linux for Windows. What is a Static Library? A static library is a file that contains pre-compiled code that can be linked with an executable program to create a single, self-contained executable. The code in a static library is linked directly into the executable, which makes it faster and more efficient than ...

Read More

How to align 3 files based on first column value

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 194 Views

When working with data analysis, it is often necessary to align multiple files based on a shared column. This process involves combining data from different sources using a common identifier, typically found in the first column. File alignment is essential for creating comprehensive datasets that can be analyzed effectively. Why Align Multiple Files? In data analysis, we frequently encounter situations where related information is stored across separate files. Aligning these files based on a common column allows us to: Combine data from multiple sources for comprehensive analysis Detect errors and inconsistencies across datasets Create unified reports ...

Read More

Does mprotect flush instruction cache on ARM Linux

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 314 Views

When working with ARM-based Linux systems, one critical function that programmers often need to use is mprotect. This function is used to protect specific areas of memory from unauthorized access, modification, or execution. However, a common question asked by developers is whether mprotect flushes the instruction cache on ARM Linux. In this article, we will explore the concept of mprotect and its impact on instruction cache coherency on ARM Linux systems, discussing practical examples and scenarios to help understand this behavior. What is mprotect? mprotect is a system call that allows programmers to modify memory protection settings ...

Read More

How to investigate which process causes wakeups during laptop sleep-mode in MacOS (or Linux)

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 2K+ Views

When a laptop goes into sleep mode, the operating system tries to conserve power by stopping most processes and putting the computer in a low-power state. However, sometimes a process may continue to run or periodically wake up the computer, preventing it from entering a deep sleep state. This can lead to increased power consumption and shorter battery life. In this article, we'll explore how to investigate which process is causing wakeups during laptop sleep-mode in MacOS or Linux. Understanding Power Management Subsystem Before diving into how to investigate sleep mode wakeups, it's important to understand the power ...

Read More

Repeat a Linux Command at a Given Interval

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 15K+ Views

Linux is a powerful operating system that offers a wide range of command-line tools for executing various tasks. One task that often needs to be performed is repeating a command at a given interval. This feature can be useful for several reasons, such as monitoring system performance, running scheduled tasks, and performing automated backups. In this article, we will explore how to repeat a Linux command at a given interval. We will discuss various methods to achieve this, including using the cron utility, watch command, sleep command, and other scheduling tools. Using Cron to Repeat a Command ...

Read More

Why Do We Use su – and Not Just su

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 2K+ Views

The Linux operating system is a powerful tool that offers a wide range of features and functionalities to its users. One of the most common tasks performed by system administrators on Linux systems is to switch to the root user account using the su command. However, in some cases, it is recommended to use su - instead of just su. In this article, we will explore the reasons behind using su - and provide examples of how it can be beneficial. What is the Difference Between su and su -? The su command is used to switch to ...

Read More

How to write Stdout to a file with colors?

Vishesh Kumar
Vishesh Kumar
Updated on 17-Mar-2026 1K+ Views

When working with command-line tools that produce colorized output, preserving these colors when redirecting to files can be challenging. By default, most programs detect when their output is redirected and strip away ANSI color codes. This article covers various methods to capture colored terminal output in files while maintaining the original formatting. Using Grep with Color Preservation The grep command searches for text patterns using regular expressions. To preserve colors when redirecting output, use the --color=always option. Syntax $ grep [options] pattern [files] Example First, create a sample file and then use ...

Read More

How to End Processes With kill, pkill, and killall

Satish Kumar
Satish Kumar
Updated on 17-Mar-2026 4K+ Views

When working with a Unix-based operating system such as Linux or macOS, it is common to encounter situations where a process becomes unresponsive or needs to be terminated for some reason. Fortunately, there are several command-line utilities available that allow users to end processes in a variety of ways. In this article, we will explore three of the most commonly used utilities for terminating processes: kill, pkill, and killall. We will cover their basic usage, common options, and examples of how they can be used to manage processes on a Unix system. Basic Usage of kill, pkill, and killall ...

Read More
Showing 221–230 of 1,337 articles
« Prev 1 21 22 23 24 25 134 Next »
Advertisements