Mukul Latiyan

Mukul Latiyan

363 Articles Published

Articles by Mukul Latiyan

Page 11 of 37

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 479 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 quickly sum all the numbers in a file on Linux?

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

Consider that we have a file named bar that contains different numbers inside it. The bar file looks something like this − immukul@192 linux-questions-code % cat bar 11 12 13 We need to get the sum of all the numbers present in the above file. There are several approaches and solutions that we can consider using different commands and techniques. Let's explore these possible solutions one by one. Bash Script Approach The most basic approach is to open the file and read the contents, then calculate the sum of all the numbers using a ...

Read More

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

Mukul Latiyan
Mukul Latiyan
Updated on 17-Mar-2026 686 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 997 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 966 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

How to see top processes sorted by actual memory usage on Linux?

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

Linux provides the famous top command utility that displays information about running processes, including their process IDs, CPU usage, and memory consumption. However, the default output is not sorted by memory usage, and the display order changes frequently as processes consume different amounts of resources. In many scenarios, system administrators need to identify which processes are consuming the most memory to troubleshoot performance issues or optimize system resources. This requires sorting processes by their actual memory usage in descending order. Using the ps Command The most effective approach is to use the ps command with sorting options. ...

Read More

How to set a proxy for wget on Linux?

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

Wget is a Linux command-line utility used to retrieve files from the World Wide Web (WWW) using protocols like HTTP, HTTPS, and FTP. It is a freely available package that can be downloaded and installed on any Linux-supporting architecture. One of the key features of wget is its ability to automatically resume downloading where it left off in case of network issues. It also supports recursive downloads and will keep trying to download files until they are retrieved completely. Installing wget For Ubuntu/Debian sudo apt-get install wget For CentOS/RHEL/Fedora sudo yum ...

Read More
Showing 101–110 of 363 articles
« Prev 1 9 10 11 12 13 37 Next »
Advertisements