Linux Articles

Page 56 of 134

How to use the grep command to search for a string that has a dot in it?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 822 Views

In order to be able to grep a string that has a dot inside it, we must first understand what a grep command is and how to use it on Linux. The grep command in Linux is used to filter searches in a file for a particular pattern of characters. It is one of the most used Linux utility commands to display the lines that contain the pattern that we are trying to search. Normally, the pattern that we are trying to search in the file is referred to as the regular expression. Syntax grep ...

Read More

How to use the sed command to replace a text in files present in a directory and subdirectories?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 859 Views

Let's consider a case where we have two directories, say, d1 and d2 and both these directories contain some files, which may be the same or different. Now we want to make use of the sed command to replace a particular text that might be present in some of the files in either the d1 directory or the d2 directory. The sed command, which is short for stream editor, is used to perform different functions like find, replace, insert and many more on a particular file. When combined with the find command, it becomes a powerful tool for batch ...

Read More

How to use the sub process module with pipes on Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 520 Views

In Python, the subprocess module allows us to work with additional processes and provides a high-level interface for executing system commands. While other modules like os.spawn(), os.system(), and os.popen() offer similar functionality, subprocess is recommended because it provides better control, security, and flexibility. When working with subprocess on Linux, pipes allow us to chain commands together, passing the output of one command as input to another. This is essential for building secure command pipelines without shell injection vulnerabilities. Basic Subprocess Example Let's start with a simple example that demonstrates basic subprocess usage: import subprocess ...

Read More

How to write multiple line strings using Bash with variables on Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 4K+ Views

Bash supports multiple approaches for creating and handling multiline strings. This functionality is essential when working with formatted output, configuration files, or complex text processing tasks in shell scripts. There are three primary methods to create multiline strings in Bash, each with its own advantages depending on the use case. Method 1: Using Escape Sequences The simplest approach uses the newline character to separate lines within a string. This method works well for short strings and when you need precise control over formatting. Example #!/bin/bash approach1="First Line TextSecond Line TextThird Line Text" ...

Read More

How would I get a cron job to run every 30 minutes on Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 1K+ Views

Crontab is a time-based job scheduler in Linux that allows you to automate the execution of commands, scripts, or programs at specific intervals. To create a cron job that runs every 30 minutes, you need to understand the crontab syntax and configure the appropriate time specification. Understanding Crontab Syntax A cron job entry consists of five time fields followed by the command to execute: * * * * * command_to_run | | | | | | | | | +-- Day of Week (0-6, Sunday=0) | | | +---- Month (1-12) | | +------ Day of ...

Read More

Is there a goto statement available in bash on Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 2K+ Views

Bash on Linux does not have a built-in goto statement. Unlike languages such as C or BASIC, bash lacks native goto functionality, and no official control structures exist in the bash documentation to provide direct jump capabilities. However, we can simulate goto-like behavior using alternative approaches with break, continue, and conditional statements. Alternative Approaches to Goto While bash doesn't support goto directly, there are several ways to achieve similar control flow behavior. Method 1: Using Conditional Statements The simplest way to skip code blocks is using if statements with conditions that control execution flow − ...

Read More

Linux – How to resolve the error "can't connect to Docker daemon

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 314 Views

The "can't connect to Docker daemon" error is one of the most common issues that new Docker users encounter when trying to start Docker services. This error typically appears when attempting to run Docker commands like docker-compose build or other Docker operations. The docker-compose command is a tool used for defining and running multi-container Docker applications. When the Docker daemon is not properly running or accessible, you'll see an error message like this: Cannot connect to the Docker daemon. Is the docker daemon running on this host? Common Causes This error occurs due to ...

Read More

Understanding .a , .so and .la library files in Linux

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 4K+ Views

In order to understand what the libraries of files with the extensions .a, .so and .la actually mean, we first must be aware of the concept of libraries in Linux. A library in its very simple terms is a collection of pre-compiled pieces of code which are known as functions. Libraries are very useful as they provide reusable functions, classes and data structures. Some examples of libraries in Linux are glibc (GNU version of standard C library), libc (the C standard library). In total we can divide the libraries in Linux into two categories. These categories are − ...

Read More

Understanding stdin, stderr and stdout in Linux

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 24K+ Views

There is a decent chance that if you have used Linux operating systems then you might have encountered the three famous data streams known as stdin, stderr and stdout. All these are different in their functions and have their own uses but one thing common between all three of them is that they are data streams that the shell creates. Let's understand more about what data streams actually mean and how they are beneficial. In terms of computing, a data stream is something that gives us the ability to transfer data from a source to an outflow and vice ...

Read More

What does opening a file actually do on Linux?

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 731 Views

When we talk about opening a file in Linux, the process varies depending on the programming language and API being used. However, most high-level languages eventually call either the C library functions or directly invoke the Linux open() system call. This article focuses on what happens at the kernel level when a file is opened in C on a Linux system. The sys_open() System Call At the heart of file opening is the sys_open() system call. When you call open() in C, it eventually triggers this kernel function found in fs/open.c: int sys_open(const char *filename, int ...

Read More
Showing 551–560 of 1,338 articles
« Prev 1 54 55 56 57 58 134 Next »
Advertisements