Shell Scripting Using VirtualBox
STEP 1 — Install VirtualBox
1. Go to the official VirtualBox download page (search “VirtualBox download”).
2. Choose your operating system (Windows, macOS, or Linux).
3. Download and run the installer.
4. Click Next → Next → Install until finished.
5. Launch VirtualBox.
STEP 2 — Download a Linux ISO (Ubuntu
Recommended)
1. Search “Ubuntu ISO download”.
2. Download Ubuntu Desktop ISO (LTS version recommended).
3. Save the file—it will be used to install Linux inside VirtualBox.
STEP 3 — Create a New Virtual Machine
1. Open VirtualBox.
2. Click New.
3. Enter the following:
o Name: Ubuntu (or any name)
o Type: Linux
o Version: Ubuntu (64-bit)
4. Click Next.
STEP 4 — Allocate Memory (RAM)
1. Set RAM to 2048 MB (2GB) or higher (if your PC allows).
2. Click Next.
STEP 5 — Create a Virtual Hard Disk
1. Choose Create a virtual hard disk now → Create.
2. Choose VDI (VirtualBox Disk Image) → Next.
3. Choose Dynamically allocated → Next.
4. Set disk size to 20 GB or more → Create.
STEP 6 — Load the Ubuntu ISO
1. Select your new VM.
2. Click Settings → Storage.
3. Under “Controller: IDE”, click the empty CD icon.
4. Click Choose a disk file.
5. Select the Ubuntu ISO you downloaded.
6. Click OK.
STEP 7 — Start the Virtual Machine
1. Click Start on your VM.
2. Ubuntu installer will load.
3. Choose Install Ubuntu.
4. Follow installation prompts:
o Keyboard: English
o Installation type: Normal
o Disk setup → “Erase disk and install Ubuntu” (this only affects the virtual disk,
not your real PC)
5. Wait until installation completes.
6. Restart the VM.
STEP 8 — Open the Terminal
After Ubuntu loads:
1. Press Ctrl + Alt + T
or
2. Click Activities → Terminal
This opens the command-line shell.
STEP 9 — Practice Basic Linux Commands
Try:
ls
pwd
cd Documents
mkdir practice
ls -l
STEP 10 — Create Your First Shell Script
Inside terminal:
1. Create a script file:
touch [Link]
2. Open it using Nano editor:
nano [Link]
3. Write a simple script:
#!/bin/bash
echo "Hello, Linux!"
4. Save:
Ctrl + O → Enter → Ctrl + X
5. Give permission to execute:
chmod +x [Link]
6. Run the script:
./[Link]
STEP 11 — Practice More Scripts
Examples:
• Creating files
• Automating commands
• Using loops
• Using if-else
• Listing system information
STEP 12 — Shut Down the VM
Click:
Power Off → OK