Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Linux Articles
Page 40 of 134
Running Multiple Commands in the Background on Linux
Executing multiple commands in the background is a powerful feature in Linux that allows users to run tasks simultaneously without blocking the terminal. This capability is essential when working with long-running processes, system administration tasks, or when you need to maintain productivity while commands execute. Linux provides several methods to run commands in the background, primarily using the & operator and the nohup command. Understanding these tools and their proper usage is crucial for effective system management. Running Commands in Background Using "&" Operator The & operator is the simplest way to run commands in the background. ...
Read MoreWhat is the LD_PRELOAD Trick on Linux?
LD_PRELOAD is a powerful and advanced feature in the Linux dynamic linker that allows users to preload shared object files into the address space of a process before it starts executing. This can be used to override certain functions in the process with custom implementations or to inject additional code into the process at runtime. LD_PRELOAD is often used for debugging and testing purposes, but it can also be used for malicious purposes, such as injecting malware into processes. How LD_PRELOAD Works The LD_PRELOAD environment variable specifies a list of shared object files that the dynamic linker should ...
Read MoreCreating a Temporary File in Linux
In Linux, it is often necessary to create temporary files for various purposes, such as storing intermediate data during processing or storing configuration information for a script. Temporary files are usually created in the /tmp directory, which is a standard location for storing temporary files on most Linux systems. The mktemp Command The most common and secure method to create temporary files in Linux is using the mktemp command. This command creates a unique temporary file with proper permissions and prints the file name to the console. Syntax mktemp [options] [template] The template ...
Read MoreDelete Multiple Files at Once in Bash
Bash is a Unix shell and command language that is commonly used on Linux systems. It allows users to perform a variety of tasks, including deleting files. In this article, we will look at how to delete multiple files at once in Bash on a Linux system. We will cover the basic syntax for deleting multiple files, as well as some advanced techniques for deleting specific types of files or forcing the deletion of write-protected files. Using rm Command in Linux The rm command is used to delete files in Bash. To delete a single file, you can ...
Read MorePartitioning Disks in Linux
In Linux, a disk partition is a logical division of a hard disk drive (HDD) or solid-state drive (SSD) that allows you to manage data in a more organized manner. Partitions enable you to separate data by function, such as isolating system files from user files, or setting up multiple operating systems on a single physical disk. There are several tools available for creating and managing disk partitions in Linux, including fdisk, parted, and gparted. This article focuses on using the command-line utilities fdisk and parted as they are widely available on most Linux distributions and provide precise control ...
Read MoreMeasure CPU usage for a process on Linux?
On modern multi-core CPUs, monitoring CPU usage of individual cores for specific processes is essential for performance analysis and identifying system bottlenecks. This article demonstrates how to measure CPU core usage for processes on Linux using various command-line tools. Monitoring CPU Usage with top Command The top command is the most common tool for monitoring system resources. By default, it shows aggregate CPU usage, but you can view per-core statistics. To display individual CPU core usage, run top and press 1 to toggle per-core view: $ top Then press 1 to see individual ...
Read MoreCount Duplicate Lines in a Text File on Linux
There are several reasons why you might want to count duplicate lines in a text file on Linux. You may need to identify data inconsistencies, optimize files by removing duplicates, or analyze log files for repeated entries. Linux provides multiple powerful command-line tools to accomplish this task efficiently. Preparation Let's create a sample text file to demonstrate the different methods. Open a terminal and create a test file − $ touch test.txt Add the following content to the file using your preferred text editor − Hello World Hello Linux Linux ...
Read MoreImplement a Counter in Bash Script on Linux
Counters in Bash scripts are variables used to track the number of times specific events or tasks occur. They are essential for loop control, progress tracking, and performing actions after reaching certain thresholds. Understanding how to implement and use counters effectively can significantly improve your Bash scripting capabilities. What is a Counter Variable in Bash Script? A counter is a variable that stores and increments numerical values to count occurrences of events or iterations. It is commonly used in loops to track the number of iterations performed, count files in directories, or monitor task completion progress. Why ...
Read MoreKeeping SSH session alive on Linux
Secure Shell (SSH) is a network protocol that allows secure remote connections between two systems. It is commonly used to access and manage Linux servers remotely. However, SSH sessions can be terminated due to network timeouts, inactivity, or connection drops, which can be frustrating during long-running tasks. This article discusses various methods to keep SSH sessions alive on Linux systems. Server-Side Configuration Using ClientAliveInterval Option The most effective way to prevent SSH sessions from timing out is to configure the SSH server to send keep-alive packets. This is done using the ClientAliveInterval option in the SSH server ...
Read MoreCalculate an MD5 Checksum of a Directory in Linux
During our daily use of Linux, we may want to check if there are any changes to any of the files in a directory. Or we might want to confirm that the contents of one directory are the same as those of another directory on a different location, disk, or system. In this tutorial we will learn how to compute an MD5 checksum of an entire directory tree on Linux. We will compute a single hash value of all directory contents for comparison purposes. Get the List of All Files in a Directory Tree To find out the ...
Read More