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
Operating System Articles
Page 86 of 171
How to know what the 'errno' means in Linux?
Errno is a global variable in Linux and Unix systems that indicates the type of error that occurred during system calls and library function execution. When a system call or library function encounters an error, it sets the errno variable to a specific integer value that corresponds to the type of error. This mechanism allows developers to identify and handle different types of errors programmatically. The errno variable is defined in the header file and is thread-local in modern implementations. Each error code has both a numeric value and a symbolic constant name written in uppercase letters. ...
Read MoreHow to limit the number of results returned from grep in Linux?
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 MoreHow to list down all the available commands and aliases on Linux?
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 MoreHow to match two strings that are present in one line with grep in 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 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 MoreHow 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 More