Menu

Log in

Sign up

From beginner to master of web design, coding, infrastructure operation, business development and marketing

  • COURSES
  • HTML & CSS Introduction
  • HTML & CSS Coding with AI
  • Linux Introduction
  • Docker Basics
  • Git & GitHub Introduction
  • JavaScript Coding with AI
  • Django Introduction
  • AWS Basics
  • Figma Introduction
  • SEO Tutorial for Beginners
  • SEO with AI
  • OTHERS
  • About
  • Terms of Service
  • Privacy Policy

© 2024 D-Libro. All Rights Reserved

Linux IntroductionChapter 5. Redirection, Pipe and Shell Script

Chapter 5. Redirection, Pipe and Shell Script

Understanding Redirection, Pipe, and Shell Scripting

In this chapter, we’ll explore key Linux commands, including redirection of standard input, output, and error, the pipe to combine commands, and writing shell scripts to automate tasks. These commands form the core of Linux command-line operations, helping you to manage data input, output, and script executions effectively.

What We Cover in This Chapter

The following topics are covered in this chapter:

Standard Input Output and Redirection

In this section, we’ll explain the concept of standard input, output, and redirection. We’ll look at how these elements are managed in the Linux environment and explore how they work with commands like sort and cat for input and output redirection.

Pipe (Combine Commands)

In this section, we’ll show you how to use the pipe symbol (|) to link multiple commands together. This allows you to feed the output of one command as the input of another, making complex tasks simpler and faster.

less (Display Content with Pager)

In this section, we’ll explore the less command, a useful pager for viewing large files one page at a time. We’ll also demonstrate its use in combination with other commands like ls to paginate the output.

tr (Replace Characters)

In this section, we’ll dive into the tr command, which is used for translating or replacing characters. We’ll show you how to use it with pipes and file redirection to replace characters in a text stream.

cut (Extract Data Sections)

In this section, we’ll demonstrate the cut command, which extracts specific fields from a text file. We’ll explain how to use it to process delimited data and save the extracted information into another file.

uniq (Extract Unique Data Lines)

This section covers the uniq command, which filters out repeated lines in a file. We’ll also explore its usage with the sort command to extract unique data entries efficiently.

Shell Script

In this section, we’ll introduce you to shell scripting, which allows you to combine multiple Linux commands into a single script for automation. You’ll learn how to write simple scripts, make them executable, and run them from the command line.

echo (Echo Input)

This section will teach you the basics of the echo command, which outputs text or variable contents to the screen. You’ll learn how to use it with both strings and variables in a shell script.

read (Read and Store Input)

Here, we’ll cover the read command, which allows you to take user input from the command line and store it in a variable for later use.

Shell Variable and Environmental Variable

In this section, we’ll differentiate between shell variables and environmental variables. We’ll explain their scope and how environmental variables can be shared between processes.

source (Execute Shell Script and Refresh Environmental Variables)

This section will show you how to use the source command to execute shell scripts and refresh environmental variables without leaving the current shell session.

Learn offline for better focus!
A book for this course is available on Amazon.

Linux Visual Guide

Step-By-Step Manual for Complete Beginners to Mastering Linux Basics, Vim Editor, Command Management, Remote Server Operation, and More.

Your browser does not support the video tag.
Get the Book Now

More Topics to Explore

Foreground and Background Jobs

Foreground and Background Jobs

How to Set Up Git & GitHub Projects for Different Roles

Git & GitHub Project Setup Overview in Different Cases

Mastering Git and GitHub: Supplemental Topics

Chapter 7. Supplemental Topics

Exploring Modes in Vim Editor on Linux

Normal, Insert and Visual Mode

How to Use Squash Merge in Git

Squash Merge

Foreground and Background Jobs

Foreground and Background Jobs

How to Set Up Git & GitHub Projects for Different Roles

Git & GitHub Project Setup Overview in Different Cases

Mastering Git and GitHub: Supplemental Topics

Chapter 7. Supplemental Topics

Exploring Modes in Vim Editor on Linux

Normal, Insert and Visual Mode

How to Use Squash Merge in Git

Squash Merge

Tags:

Redirection

Standard Input

Shell Script

Pipe

Standard Output

Linux Introduction
Course Content

Chapter 1. Linux Basics

What Is OS?

CUI and GUI

Linux Distributions

Package Manager

Kernel and Shell

Current Working Directory

Linux Directory Structure

Absolute Path and Relative Path (Linux OS)

Linux Command Syntax

Special Characters and Escape Character

Chapter 2. Linux Key Commands

Setting Up Linux Environment on AWS

pwd (Print Working Directory)

cd (Change Directory)

ls (List Contents of Directory)

mkdir (Make Directory)

rmdir (Remove Directory)

touch (Create File)

rm (Remove File)

mv (Move File and Directory)

cp (Copy File and Directory)

cat (Display File Content)

sort (Sort File Contents)

grep (Global Regular Expression Print)

Regular Expression

find (Find File and Directory)

Wildcard

ln (Create Link to File and Directory)

Chapter 3. Vim Editor

What Is Vim and How to Launch It?

Normal, Insert and Visual Mode

Normal Mode (1) – Move Cursor

Normal Mode (2) – Delete

Normal Mode (3) – Copy and Paste

Normal Mode (4) – Undo and Redo

Normal Mode (5) – Search Phrase

Normal Mode (6) – Replace Phrase

Normal Mode (7) – Save and Exit

Insert Mode

Visual Mode

Chapter 4. User, Group and Permission

What Are User, Group And Permission in Linux?

Permission (Access Mode) by Owner Status

Superuser (Root User) vs. Normal User

sudo (Run Command with Superuser Privileges)

su (Switch User)

useradd (Add User)

passwd (Set Password)

userdel (Delete User)

Group – Primary Group and Secondary Group

groupadd (Add Group)

usermod (Modify User Account Information)

gpasswd (Add and Delete Users to Group)

groupdel (Delete Group)

chown (Change Owner of File and Directory)

chgrp (Change Group of File and Directory)

chmod (Change Access Mode)

chmod Command with Numbers

w and who (Check Current User Login Status)

id and groups (Check User ID and Group)

getent (Display User and Group Data)

Chapter 5. Redirection, Pipe and Shell Script

Standard Input Output and Redirection

Pipe (Combine Commands)

less (Display Content with Pager)

tr (Replace Characters)

cut (Extract Data Sections)

uniq (Extract Unique Data Lines)

Shell Script

echo (Echo input)

read (Read and Store Input)

Shell Variable and Environmental Variable

source (Execute Shell Script and Refresh Environmental Variables)

Chapter 6. Linux Commands for Command Management

history (Check Command History)

alias (Create Command Shortcuts)

man (Display Manual)

type, which and whereis (Display Command Information)

Package Manager Command

tree (Display Directory Tree)

Chapter 7. SSH Remote Connection

SSH (Secure Shell)

Locate .ssh Directory

SSH Remote Login (1) – Use Key Pair Generated by Server

SSH Remote Login (2) – Use Key Pair Generated by Client

SSH Config File

SSH Remote Login with Visual Studio Code

SCP (Secure Copy Protocol)

SCP with SSH Config File

SFTP (Secure File Transfer Protocol)

Other File Transfer Commands

Chapter 8. Linux Process Management

Process and Job

Foreground and Background Jobs

jobs and ps (Display Jobs and Processes)

Signals

Create, Stop and Terminate Jobs

Daemon Processes

What Is Service on Linux?

Systemd

Unit File

Systemctl Sub-Commands

Create Custom Unit and Start at Boot

Firewall

UFW (Uncomplicated Firewall)

Web Server

Launch Apache Web Server

Chapter 1. Linux Basics

What Is OS?

CUI and GUI

Linux Distributions

Package Manager

Kernel and Shell

Current Working Directory

Linux Directory Structure

Absolute Path and Relative Path (Linux OS)

Linux Command Syntax

Special Characters and Escape Character

Chapter 2. Linux Key Commands

Setting Up Linux Environment on AWS

pwd (Print Working Directory)

cd (Change Directory)

ls (List Contents of Directory)

mkdir (Make Directory)

rmdir (Remove Directory)

touch (Create File)

rm (Remove File)

mv (Move File and Directory)

cp (Copy File and Directory)

cat (Display File Content)

sort (Sort File Contents)

grep (Global Regular Expression Print)

Regular Expression

find (Find File and Directory)

Wildcard

ln (Create Link to File and Directory)

Chapter 3. Vim Editor

What Is Vim and How to Launch It?

Normal, Insert and Visual Mode

Normal Mode (1) – Move Cursor

Normal Mode (2) – Delete

Normal Mode (3) – Copy and Paste

Normal Mode (4) – Undo and Redo

Normal Mode (5) – Search Phrase

Normal Mode (6) – Replace Phrase

Normal Mode (7) – Save and Exit

Insert Mode

Visual Mode

Chapter 4. User, Group and Permission

What Are User, Group And Permission in Linux?

Permission (Access Mode) by Owner Status

Superuser (Root User) vs. Normal User

sudo (Run Command with Superuser Privileges)

su (Switch User)

useradd (Add User)

passwd (Set Password)

userdel (Delete User)

Group – Primary Group and Secondary Group

groupadd (Add Group)

usermod (Modify User Account Information)

gpasswd (Add and Delete Users to Group)

groupdel (Delete Group)

chown (Change Owner of File and Directory)

chgrp (Change Group of File and Directory)

chmod (Change Access Mode)

chmod Command with Numbers

w and who (Check Current User Login Status)

id and groups (Check User ID and Group)

getent (Display User and Group Data)

Chapter 5. Redirection, Pipe and Shell Script

Standard Input Output and Redirection

Pipe (Combine Commands)

less (Display Content with Pager)

tr (Replace Characters)

cut (Extract Data Sections)

uniq (Extract Unique Data Lines)

Shell Script

echo (Echo input)

read (Read and Store Input)

Shell Variable and Environmental Variable

source (Execute Shell Script and Refresh Environmental Variables)

Chapter 6. Linux Commands for Command Management

history (Check Command History)

alias (Create Command Shortcuts)

man (Display Manual)

type, which and whereis (Display Command Information)

Package Manager Command

tree (Display Directory Tree)

Chapter 7. SSH Remote Connection

SSH (Secure Shell)

Locate .ssh Directory

SSH Remote Login (1) – Use Key Pair Generated by Server

SSH Remote Login (2) – Use Key Pair Generated by Client

SSH Config File

SSH Remote Login with Visual Studio Code

SCP (Secure Copy Protocol)

SCP with SSH Config File

SFTP (Secure File Transfer Protocol)

Other File Transfer Commands

Chapter 8. Linux Process Management

Process and Job

Foreground and Background Jobs

jobs and ps (Display Jobs and Processes)

Signals

Create, Stop and Terminate Jobs

Daemon Processes

What Is Service on Linux?

Systemd

Unit File

Systemctl Sub-Commands

Create Custom Unit and Start at Boot

Firewall

UFW (Uncomplicated Firewall)

Web Server

Launch Apache Web Server