Open Source Articles

Page 52 of 123

How to limit the number of results returned from grep in Linux?

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

The grep command in Linux is a powerful text search utility used to filter and search for specific patterns in files. When working with large files or datasets, you may want to limit the number of results returned to make the output more manageable and focused. The grep command searches for lines containing a specified pattern (regular expression) and displays matching results. By default, it returns all matching lines, but Linux provides several options to limit and control the output. Syntax grep [options] pattern [files] Common Grep Options Option Description ...

Read More

How to list down all the available commands and aliases on Linux?

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

Linux provides a vast collection of commands and aliases that users can utilize in the terminal. These commands serve different purposes and can be executed from anywhere in the command line interface. Understanding how to list available commands and aliases is essential for efficient Linux system administration and usage. There are several approaches to discover all available commands in Linux. You can write custom shell scripts or use built-in shell functions designed for this purpose. The most effective method involves using the compgen command, which is a bash builtin specifically designed to list various shell components. Using the ...

Read More

How to match two strings that are present in one line with grep in Linux?

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

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 lines that contain the pattern we are searching for. When we need to find lines containing multiple strings, we can combine grep commands or use pattern matching techniques. The pattern we search for is referred to as a regular expression, and grep provides several methods to match multiple strings on the same line. Basic Grep Syntax grep [options] pattern [files] Common Grep Options ...

Read More

How to perform grep operation on all files in a directory?

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

The grep command in Linux is used to search for patterns within files. It displays lines that match a specified pattern (regular expression) and is one of the most essential utilities for text processing and file searching in Linux systems. Basic Syntax grep [options] pattern [files] Common Options Option Description -c Lists only a count of matching lines -h Displays matched lines without filenames -i Ignores case for matching -l Prints filenames only (not the matching lines) -n Displays ...

Read More

How to preserve colouring after piping grep to grep in Linux?

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

In order to preserve colouring after using pipes between grep commands, we must first understand what the grep command is and how it handles output coloring in Linux. The grep command in Linux is used to filter searches in files for a particular pattern of characters. It is one of the most used Linux utility commands to display lines that contain the pattern we are searching for. The pattern we search for is typically called a regular expression. By default, grep displays colored output when writing directly to a terminal, but this coloring is lost when output is ...

Read More

How to prevent a background process from being stopped after closing SSH client in Linux?

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

A background process in Linux is a process that runs independently of the shell session. When you start a background process and then close your SSH client, the process typically gets terminated due to the SIGHUP signal (hangup signal) sent to all child processes. This article explains several methods to prevent background processes from being stopped after SSH disconnection. Starting Background Processes In Linux, you can start a process in the background by appending the & symbol after the command: sleep 10000 & This command runs the sleep process in the background for 10, ...

Read More

How to replace spaces in file names using bash script on Linux?

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

Consider a case in which one directory on my local machine looks something like this − immukul@192 dir1 % ls -ltr total 0 -rw-r--r-- 1 immukul staff 0 Jul 3 20:44 sample code.txt -rw-r--r-- 1 immukul staff 0 Jul 3 20:44 sample code with love.txt In the above directory named dir1, there are two .txt files present and both these files have spaces in between the words in their name, and we need to replace these spaces using a bash script on Linux. In order to achieve what we want, we must first be aware ...

Read More

How to resume a partially transferred file over ssh on Linux?

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

File transfer interruptions are common when copying large files over SSH connections. Network instability, connection timeouts, or accidental process termination can cause transfers to fail partway through. While the scp command doesn't support resuming interrupted transfers, Linux provides rsync as a powerful alternative that can resume partially transferred files. The scp command forces you to restart the entire transfer from the beginning, overwriting any partially transferred data. This becomes extremely frustrating and time-consuming when dealing with large files or unreliable network connections. What is Rsync? Rsync (Remote Sync) is a versatile command-line utility for synchronizing files and ...

Read More

How to run a crontab job every week on Sunday?

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

In order to create a crontab job to run every Sunday, we first need to explore and understand what a crontab job is. A crontab is nothing but a list of commands that we can run during a cron job. A cron job is a utility that schedules automatic execution of commands at specific times. Creating a Crontab Job We can start a cron job with the help of bash script by following the commands shown below − crontab -e This will open a file which you can edit, insert the cron job ...

Read More

How to search contents of multiple pdf files on Linux?

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

The pdfgrep command in Linux is a powerful utility used to search for specific text patterns within PDF files. It functions similarly to the standard grep command but is specifically designed for PDF documents, making it invaluable for searching through multiple PDF files simultaneously. The search pattern can be a simple text string or a regular expression, allowing for flexible and precise searches across your PDF collection. Installing pdfgrep For Ubuntu/Debian sudo apt-get update -y sudo apt-get install -y pdfgrep For CentOS/RHEL yum install pdfgrep For Fedora ...

Read More
Showing 511–520 of 1,225 articles
« Prev 1 50 51 52 53 54 123 Next »
Advertisements