Introduction On Linux, there are several ways to recursively remove files with a specific extension (.xyz) in a directory and its subdirectories. Deleting files recursively means deleting all files with the specified extension from the directory and all of its subdirectories. This operation can take a long time if done manually, especially for a large number of files. In this article, we will look at three methods to recursively delete files with a specific extension on Linux. Using the rm command The rm command is a basic file manipulation tool in Linux used to remove files and directories. It can ... Read More
Introduction The tr (translate) command is a Linux utility that allows you to perform various transformations on text input. Whether you need to change case, remove repeating characters, remove characters, set complements or remove newline characters, tr can handle it all. In this article, we'll explore the various options available with the tr command and show you how to use them to transform text. Syntax of tr Command The basic syntax of the ‘tr’ command is as follows − $ tr SET1 SET2 < inputfile where − SET1 is a set of characters to be replaced by the ... Read More
Passing out during a seizure can happen to some people, which can make distinguishing between the two conditions difficult. Seizures, usually referred to as convulsions, are sudden, uncontrolled electrical abnormalities in the brain. In contrast, when someone is unconscious, they have completely lost consciousness, as happens during profound slumber or a coma. The following topics will go into the comparison between unconsciousness and seizures. What is Seizure? The abnormal electrical impulses in the brain's cortex cause the strange behaviour known as a seizure. Symptoms − Twitching and other uncontrollable action of the limbs and body, mental confusion, a loss ... Read More
Introduction As a Linux user, it's common to run the same command in multiple directories. For example, you might want to search for all files with a certain extension or run a shell script in multiple directories. This task can be time-consuming if done manually, and becomes even more tedious as the number of directories increases. Fortunately, Linux provides several methods for running a command across multiple directories efficiently. In this article, we'll take a look at some of these methods and show you how to run a command on multiple directories in Linux. Using the Find Command to Execute ... Read More
Introduction Linux is a powerful and adaptable operating system with numerous features that make it suitable for both personal and business use. File permissions are one of these features that is very important because they let you control who can access and change your files. We'll take a closer look at Linux's advanced file permissions in this article, focusing on some of the most important ideas and commands. Setting File Permissions in Linux Understanding Linux file permissions starts with knowing how to set them. The chmod command, which stands for "change mode, " is used to accomplish this. Change the ... Read More
A group of four positive integers (a, b, c, and d) that satisfy the Pythagorean equation are called Pythagorean quadruples. The equation can be written as: a2 + b2 + c2 = d2 , with ‘d’ being the largest value out of the given numbers. In other words, the square of the fourth integer should be equal to the sum obtained by adding the squares of the previous three numbers. (1, 2, 2, 3) is a Pythagorean quadruplet as (12 + 22 + 22) = (1 + 4 + 4) = (9) = (32). Due to the requirement ... Read More
Introduction The ps command is a widely used utility in Linux that provides a snapshot of current processes and their status. It helps monitor running processes, identify process ID (PID), terminal type (TTY), CPU time usage, command name, user ID and other information. This article provides a comprehensive overview of the various use cases of the ps command in real life. Syntax of ps Command The basic syntax of the ps command is as follows − $ ps [OPTIONS] The ps command supports three different syntax styles: Unix, BSD, and GNU. Unix-style syntax can be wrapped and preceded by ... Read More
Introduction In Linux-based operating systems, there are many ways to search (find) and replace text in a file. Depending on the size of a file and the complexity of the find and replace operation, different tools and commands may be more appropriate. In this article, we'll learn a few different methods of finding and replacing text in Linux environments. Using the sed command to find and replace text The sed (stream editor) command line tool is another powerful tool that can be used to find and replace text in files on Linux. This tool is often used to perform more ... Read More
A number is considered to be a “Selfie Number” if it can be represented using only its own digits and certain mathematical operations. For example, 936 is a selfie number. $$\mathrm{936\:=\:(\sqrt{9})!^{3} \:+\:6!\:=\:216\:+\:720\:=\:936}$$ Here it can be observed that a series of operations are performed on the digits of the original number and the resultant is equal to the original number. Palindromic Selfie Numbers are a special kind of selfie number. They satisfy the selfie multiplicative rule. Consider a number x. Let the number formed by reversing the digits of x be $\mathrm{x^\prime}$. Let y be a ... Read More
In the following article, we discuss two approaches to find the closest numbers from a list of unsorted integers. Let us first understand what is meant by the term ‘closest numbers’. Closest numbers are the pair(s) of numbers which have the least difference between them. Problem Statement Given a list of distinct unsorted integers, we need to find the pair of elements that have the least difference between them. If there are multiple pairs, we need to find all of them. Furthermore, in the article wherever there is a mention of difference, it means absolute difference. Examples Input: [44, 42, ... Read More