In Shell Scripting, commands and keywords are essential for automation, system management, and DevOps tasks. Below is a comprehensive list categorized for easy learning.


📌 1. Basic Shell Commands

These commands are used frequently in scripts for file management, process control, and system tasks.

Command Description
echo Print text or variables to the console
printf More advanced text formatting than echo
read Take user input
pwd Show current working directory
cd Change directory
ls List files and directories
cp Copy files/directories
mv Move or rename files/directories
rm Remove files or directories
mkdir Create a new directory
rmdir Remove empty directories
find Search for files and directories
grep Search for text patterns in files
awk Process and format text
sed Stream edit text (find & replace)
cat View file contents
tac View file contents in reverse
head Show first N lines of a file
tail Show last N lines of a file
touch Create an empty file
chmod Change file permissions
chown Change file ownership
stat Display file metadata
df Show disk usage
du Show directory/file size
tar Archive files
zip/unzip Compress or extract files

📌 2. Variables and Operators

📍 Defining and Using Variables

#!/bin/bash
name="Thirumalesh"
echo "Hello, $name"

Command Description
VAR=value Define a variable
$VAR Access a variable
export VAR=value Make variable available in subshells
unset VAR Remove a variable

📍 Arithmetic Operators

x=$((5 + 3))
echo $x  # Output: 8

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus (remainder)
** Exponentiation

📍 Comparison Operators

Used in if statements.

if [ $a -eq $b ]; then
  echo "Equal"
fi

Operator Description
-eq Equal to
-ne Not equal to
-gt Greater than
-lt Less than
-ge Greater than or equal
-le Less than or equal

📌 3. Conditional Statements