Shell Script · Lesson

Shell Scripting · Lesson 2

Linux Shell Basics

Add YouTube embed URL in components/shell/ShellLessons.js

What is a Linux Shell?

A shell is a command-line interface that allows users to interact with the Linux operating system. It acts as a bridge between the user and the kernel.

When you type a command, the shell interprets it and requests the kernel to perform the required action such as running a program, managing files, or controlling processes.

Core Concepts of Shell

Command Interpreter

The shell reads commands entered by the user and executes them through the operating system.

User & Kernel Bridge

It connects users with the Linux kernel without requiring direct system access.

Automation Ready

Shells allow automation using scripts to perform repetitive tasks efficiently.

Basic Shell Commands

1. Open a Shell Session

Open your terminal and start interacting with the system.

terminal — bash
shell-basic
$ whoami
jay
 
$ pwd
/home/jay

2. Basic Navigation Commands

Use basic commands to move around the filesystem.

terminal — bash
shell-basic
$ ls
Documents Downloads Scripts
 
$ cd Documents
 
$ pwd
/home/jay/Documents

3. Check Current Shell

Find out which shell you are currently using.

terminal — bash
shell-basic
$ echo $SHELL
/bin/bash

Helpful Tips for Beginners

Learning Tips

  • Practice commands daily to build muscle memory.
  • Use the 'man' command to read manuals.
  • Avoid running unknown commands as root.

Efficiency Tips

  • Use tab completion to save time.
  • Use command history with arrow keys.
  • Organize scripts in a dedicated folder.

Practice Task – Explore the Shell

  • Open a terminal and check your current directory.
  • List files using ls.
  • Navigate into a directory using cd.
  • Check your active shell using echo $SHELL.

Next lesson: Shell Script Basics & Shebang