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
Articles by Prateek Jangid
Page 2 of 17
How to Insert a New Line Character in Linux Shell Script Output ?
In bash, a newline refers to a line's end and marks the beginning of new text. In Linux/Unix operating systems, the newline character is represented as , which instructs the terminal to move the cursor to the beginning of the next line. Many text editors don't display this character by default. Inserting newline characters serves several important purposes − It helps format output to be readable and well-structured. Separating output into sections makes it easier to locate specific information. Newlines act as line breaks that identify where one line ends and another begins in scripts. They allow you ...
Read MoreHow To List All Group in Linux ?
Groups in Linux are collections of users that provide a convenient way to manage permissions and resource access. A Linux system can have many users organized into multiple groups, where administrators assign specific privileges to control file and directory access. Users can belong to two types of groups − Primary / Login Group Secondary / Supplementary Group User-created files are assigned to this group. The primary group usually has the same name as the user. Grants additional privileges to a set of users for specific tasks or resources. Users ...
Read MoreList the Size of Each File and Directory and Sort by Size in Linux
Listing and sorting files and directories by size is essential for system administration, disk space management, and file organization. Linux provides multiple command-line tools and GUI methods to accomplish this task efficiently. This guide covers various approaches to list files and directories sorted by their size. Command Line Methods Using the ls Command The ls command is the most common tool for listing directory contents. By default, it sorts entries alphabetically, but you can modify this behavior with specific options. Basic listing with detailed information: ls -la This displays all files (including ...
Read MorePrint Lines Between Two Patterns in Linux
Printing lines between two patterns is a common text processing task in Linux when you need to extract specific sections from files. While the grep command can find lines matching patterns, it cannot easily extract content between two different patterns. For this purpose, sed and awk commands provide powerful pattern-matching capabilities. This article demonstrates various methods to print lines between two patterns using sed and awk commands with different conditions and filtering options. Sample File Setup First, let's create an example file to demonstrate the pattern matching techniques − cat example.txt Information ...
Read MoreProcessing Linux Commands in Parallel
Processing Linux commands in parallel allows administrators to execute multiple commands simultaneously, significantly improving efficiency when performing tasks like system updates, service management, and file operations. Command chaining is the technique of combining multiple commands using various operators and methods. Using the & (Background) Operator The & operator runs commands in the background, allowing the shell to execute the next command without waiting for the previous one to complete. command1 & command2 Example running ls and cat commands simultaneously: ls & cat Linux.txt [1] 6178 Don't erase the existing ...
Read MoreSet Up cURL to Permanently Use a Proxy on Linux
cURL is a command-line tool used to request data from servers and transfer it to devices. The user specifies the server URL and any data to be sent. cURL works on Windows, macOS, and Linux, supporting over 25 protocols including SFTP, FTP, HTTPS, and HTTP. It is one of the best open-source tools for API calls and debugging network requests. A proxy server acts as an intermediary between users and websites, transferring traffic while providing security and functionality layers. When using a proxy, internet requests first go to the proxy server, which evaluates them against predefined rules before forwarding ...
Read MoreUsing grep on Files That Match Specific Criteria
The grep (global regular expression print) command is a powerful text-processing utility that searches for specific patterns in files using regular expressions. It filters and displays lines containing the specified pattern, making it one of the most essential commands for system administrators and developers on Unix/Linux systems. Unlike other operating systems, finding content within files in Linux is straightforward with grep. This command can search through single files, multiple files, or entire directories, displaying matching lines or just the filenames that contain your search pattern. When using grep, keep these important points in mind: Grep is ...
Read MoreHow to Reverse a String using Unix Shell Programming?
Bash is a shell or command line interpreter that serves as a programming language for executing commands and scripts. It allows users of Unix-like systems and Windows (via Windows Subsystem for Linux) to control the operating system using text-based commands. In this article, we will solve the problem of reversing a string using Shell scripting. Given a string input, we need to print its reverse using Shell programming techniques. Input : str = "Hello" Output : "olleH" Explanation : Reverse order of string "Hello" is "olleH". Input : str = "yam" Output : "may" ...
Read MoreChanging the Default Shell in Linux
Changing the default shell in Linux is a common administrative task that gives you the flexibility to use different command-line interfaces. The default shell of most Linux systems is bash, but you can replace it with alternatives such as sh, fish, dash, or zsh. There are several reasons why you might need to change your default shell: To disable or block normal user logins using a nologin shell. Change the default shell on a shared network to meet specific user requirements. Implement shell wrapper programs that control command execution until proper authentication. This guide covers all ...
Read MoreResetting a Root Password in Linux without External Media
Resetting a root password in Linux is a critical system recovery technique that allows administrators to regain access to their system without external media. This method works by temporarily modifying the boot process to gain direct root shell access. We'll demonstrate this using CentOS 8.2, but these procedures work with most Linux distributions, though some Debian-based systems may require slight modifications. Prerequisites Physical access to the Linux server (cannot be performed remotely over a network) Basic familiarity with the Linux command line environment Ability to work quickly during the boot process Step-by-Step Password Recovery Process ...
Read More