Using Shebang #! in Linux Scripts

Pradeep Jhuriya
Updated on 17-Mar-2026 09:01:38

7K+ Views

On Linux, a shebang (#!) is a special line at the beginning of a script that tells the operating system which interpreter to use when executing the script. This line, also known as a hashbang, shabang or sharp-exclamation, starts with #! followed by the path to the interpreter. The shebang line allows you to run scripts written in any language directly from the command line. Understanding Shebang The shebang (#!) symbol indicates which interpreter, or which version of an interpreter, to use when running a script. The name is believed to have originated as a contraction of SHarp ... Read More

Using sed to Replace a Multi-Line String

Satish Kumar
Updated on 17-Mar-2026 09:01:38

12K+ Views

Sed (Stream Editor) is a powerful command-line tool used for parsing and transforming text in files or streams. While sed operates line-by-line by default, it can be configured to handle multi-line string replacements through special commands and pattern space manipulation. Understanding Sed's Basic Syntax The fundamental structure of sed's substitute command is: s/pattern/replacement/flags Where pattern is a regular expression matching the text to replace, replacement is the new text, and flags modify the command's behavior (such as g for global replacement). Multi-Line String Replacement Technique To replace multi-line strings, sed must load ... Read More

Difference Between fork() and vfork()

AmitDiwan
Updated on 17-Mar-2026 09:01:38

1K+ Views

In this post, we will understand the difference between system calls fork() and vfork() − Both fork() and vfork() are system calls used to create child processes in Unix-like operating systems. However, they differ significantly in how they handle memory management, execution order, and resource sharing between parent and child processes. The fork() System Call The fork() system call creates a new process by making a complete copy of the parent process. Here are its key characteristics: The child and parent process have separate memory spaces. The child and parent process are executed simultaneously. This ... Read More

What are thread libraries?

Bhanu Priya
Updated on 17-Mar-2026 09:01:38

15K+ Views

A thread is a lightweight subprocess and the basic unit of CPU utilization, consisting of a program counter, a stack, and a set of registers. Threads enable concurrent execution within a single process, allowing multiple sequences of instructions to run simultaneously. Given below is the structure of threads within a process − Thread Structure in Process Process Shared: Code, Data, Files Thread 1 Registers Stack Program Counter ... Read More

Difference Between sh and Bash in Linux?

Satish Kumar
Updated on 17-Mar-2026 09:01:38

15K+ Views

sh and bash are both command-line shells used in Unix-like operating systems, but they serve different purposes and have distinct capabilities. sh (Bourne shell) is the original POSIX-compliant shell, while bash (Bourne Again Shell) is an enhanced, feature-rich successor that extends sh's functionality. What is sh? The sh shell, originally developed by Stephen R. Bourne at Bell Labs, is the standard POSIX shell specification. It provides a minimal, portable command-line interface that works consistently across different Unix systems. sh focuses on compatibility and standardization, making it ideal for writing portable scripts. #!/bin/sh echo "This is a ... Read More

How to Format a Hard Disk on Linux OS

karthikeya Boyini
Updated on 17-Mar-2026 09:01:38

807 Views

In this article, we will learn how to format and configure a hard disk on Linux OS. When a new drive is installed and visible to the BIOS, it is automatically detected by the operating system. Disk drives are assigned device names beginning with hd or sd followed by a letter indicating the device order (e.g., /dev/sda, /dev/sdb). Detecting the New Hard Drive First, verify that the new drive is detected by listing all storage devices: # ls /dev/sd* /dev/sda /dev/sda1 /dev/sda2 /dev/sdb This output shows that /dev/sda is divided into two partitions (/dev/sda1 ... Read More

What happens to Open File Handle if file is Moved or Deleted?

Satish Kumar
Updated on 17-Mar-2026 09:01:38

425 Views

When working with files that have open handles, understanding how operating systems behave during file operations like deletion, moving, or replacement is crucial. This behavior depends on how filesystems manage inodes and file references internally. Understanding Files and Inodes In Linux filesystems, files are tracked using inode numbers rather than filenames. A filename is essentially a hard link that points to an inode containing the actual file data and metadata. $ touch inode_example $ stat inode_example File: inode_example Size: 0 ... Read More

Linux Commands – Remove All Text After X

Satish Kumar
Updated on 17-Mar-2026 09:01:38

410 Views

Linux commands provide powerful tools for text manipulation, including the ability to remove all text after a specific character or pattern. This is a common task when processing log files, configuration files, or any text data where you need to truncate content at a certain point. The Sed Command Sed (Stream Editor) is one of the most versatile tools for text manipulation in Linux. To remove all text after a specific character X, use the following syntax: sed 's/X.*/X/' filename This command removes everything after the first occurrence of X while preserving X itself. ... Read More

BleachBit – A Free Disk Space Cleaner

Satish Kumar
Updated on 17-Mar-2026 09:01:38

741 Views

If you're someone who's always on their computer, you know how quickly files and data can accumulate. Your device's storage capacity may seem endless at first, but it's not long before you're faced with the dreaded "low disk space" notification. This is where disk space cleaners come in. BleachBit is a free and open-source disk space cleaner known for its simplicity and efficiency. What is BleachBit? BleachBit is a disk space cleaner designed to free up space on your computer's hard drive. It's available for Windows, macOS, and Linux operating systems, and it's completely free to download and ... Read More

5 Cool New Projects to Try in Fedora Linux

Satish Kumar
Updated on 17-Mar-2026 09:01:38

838 Views

Fedora Linux is a cutting-edge, community-driven distribution known for its robustness, security, and commitment to open-source innovation. With over 15 years of active development, Fedora consistently pioneers new technologies and provides users with access to the latest software. This article explores exciting projects you can experiment with in Fedora to enhance your Linux experience. Experiment with Containers Containers revolutionize software deployment by packaging applications in portable, isolated environments. Fedora leads container innovation through Fedora CoreOS and native support for tools like Podman and Docker. Build a container image using Podman: podman build -t mycontainer . ... Read More

Advertisements