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 2. Linux Key Commands

Chapter 2. Linux Key Commands

Essential Linux Key Commands

In this chapter, we'll explore essential Linux commands for handling directories and files, using the Ubuntu OS running on AWS Lightsail. By the end of this chapter, you'll be able to confidently use commands like pwd, cd, ls, mkdir, and many others to navigate and manage files within a Linux environment.

What We Cover in This Chapter

The following topics are covered in this chapter:

Setting Up Linux Environment on AWS

In this section, we'll guide you through setting up your Linux environment on AWS Lightsail. Lightsail provides a simplified VPS solution, allowing you to quickly spin up an Ubuntu server and start using Linux without complex configurations. We'll show you how to set up your AWS account, create an instance, and connect to your Ubuntu instance via SSH.

pwd (Print Working Directory)

The pwd command prints the absolute path of your current working directory. It’s one of the first commands to master when navigating through the Linux filesystem. The command does not require any arguments—simply type pwd, and it will show you the path of your current directory.

cd (Change Directory)

The cd command allows you to change your current working directory. In this section, we’ll demonstrate how to use cd with both absolute and relative paths, as well as special directory characters like /, ., and ...

ls (List Contents of Directory)

The ls command is used to list the contents of a directory. You can use various options with ls to display different levels of detail, such as hidden files and file permissions. We’ll cover the basic usage of ls and its options like -a (to show hidden files) and -l (to show detailed file information).

mkdir (Make Directory)

The mkdir command is used to create new directories. You’ll learn how to create a directory with both relative and absolute paths, as well as using the -p option to create nested directories in one command.

rmdir (Remove Directory)

The rmdir command is used to remove empty directories. In this section, we’ll show you how to use rmdir to delete an empty directory and also cover the rm -r command for removing non-empty directories.

touch (Create File)

The touch command is used to create empty files or update the timestamp of existing files. In this section, we’ll show you how to create a new file using touch and also how to update a file’s timestamp.

rm (Remove File)

The rm command is used to remove files or directories. In this section, we’ll cover how to safely delete files and directories using the -r option for recursive deletion.

mv (Move File and Directory)

The mv command is used to move or rename files and directories. You’ll learn how to move files between directories and rename files using mv.

cp (Copy File and Directory)

The cp command is used to copy files and directories. We’ll show you how to make copies of files, and how to use the -r option to copy directories.

cat (Display File Content)

The cat command is used to display the contents of a file. We’ll also cover how to create files with cat by redirecting text input to a new file.

sort (Sort File Contents)

The sort command is used to sort the contents of a file. We’ll show you how to sort files in ascending or descending order, and how to redirect the sorted output to a new file.

grep (Global Regular Expression Print)

The grep command is used to search for specific patterns or strings within files. We’ll introduce regular expressions (regex) and demonstrate how to use grep to perform pattern searches across multiple files.

Regular Expression

In this section, we’ll dive deeper into regular expressions (regex), showing you how to use regex meta-characters in conjunction with grep to search for more complex patterns.

find (Find File and Directory)

The find command is used to locate files or directories under a specified path. We’ll cover how to use find with options like -name, -type, and -size to refine your search.

Wildcard

Wildcard characters are useful when you want to match a set of files or directories based on a pattern. We’ll show you how to use wildcards like * and ? to represent different characters in file or directory names.

ln (Create Link to File and Directory)

The ln command is used to create links to files or directories. In this section, we’ll explain the difference between symbolic and hard links, and demonstrate how to create both types using ln.

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

How to Add Models to Django Admin

Add Models in Django Admin – admin.py

Developing User Management Functions in Django

User Management Function Development with Django

Building a CRUD Web Application in Django

Chapter 4. Create CRUD Web Application

How to Add Models to Django Admin

Add Models in Django Admin – admin.py

Developing User Management Functions in Django

User Management Function Development with Django

Building a CRUD Web Application in Django

Chapter 4. Create CRUD Web Application

Tags:

Linux Command

Regular Expression

Wildcard

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