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 54 of 134
How to perform grep operation on all files in a directory?
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 MoreHow to preserve colouring after piping grep to grep in Linux?
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 MoreHow to prevent a background process from being stopped after closing SSH client in Linux?
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 MoreHow to replace spaces in file names using bash script on Linux?
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 MoreHow to resume a partially transferred file over ssh on Linux?
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 MoreHow to run a crontab job every week on Sunday?
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 MoreHow to search contents of multiple pdf files on Linux?
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 MoreHow to see top processes sorted by actual memory usage on Linux?
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 MoreHow to set a proxy for wget on Linux?
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 MoreHow to set the environmental variable LD_LIBRARY_PATH in Linux?
LD_LIBRARY_PATH is an environment variable in Linux that tells the dynamic linker where to look for shared libraries at runtime. Setting this variable allows applications to find custom libraries that are not installed in standard system directories like /usr/lib or /lib. There are several ways to set environment variables in Linux, ranging from temporary session-based settings to permanent system-wide configurations. Let's explore how to properly set the LD_LIBRARY_PATH environment variable. Setting Environment Variables Permanently To set an environment variable permanently for your user session, you need to modify your shell's configuration file. Follow these steps to set ...
Read More