Chapter 4: Basic Commands

Basic Commands in Bash — the absolute foundation.

Think of these as the “alphabet” of the terminal. Once you know these 15–20 commands really well, 80% of your daily terminal work becomes easy and fast. We’ll go slow, explain like friends in Hyderabad, show exact examples, what they do, common mistakes, and useful options.

Open your terminal now (Ctrl + Alt + T on Ubuntu, Terminal on macOS, Git Bash on Windows).

Important teacher tip first:

  • Press Tab key after typing part of a command or folder name → Bash auto-completes (magic!)
  • Press (up arrow) → see previous commands
  • Type history → see list of past commands
  • Wrong command? Just press Ctrl + C to stop and try again

Navigation & Location Commands (The Most Used Ones)

  1. pwd → Print Working Directory (Where am I right now?)

    Bash

    Example output: /home/webliance or /home/webliance/bash_class

    → Always know your location before doing anything!

  2. ls → List files and folders

    Bash

    → Shows normal files/folders

    Better versions (use these daily!):

    Bash

    Example:

    text
  3. cd → Change Directory (Go somewhere else)

    Bash

    Pro tip: cd with no argument = go home

    Bash

File Creation & Viewing

  1. touch → Create empty file or update timestamp

    Bash
  2. cat → Show content of file (concatenate)

    Bash

    Good for small files. For big files use less or more (next).

  3. echo → Print something on screen (very useful in scripts too)

    Bash
  4. mkdir → Make Directory

    Bash
  5. rmdir → Remove empty directory

    Bash

Copy, Move, Rename, Delete

  1. cp → Copy files/folders

    Bash
  2. mv → Move or Rename

    Bash
  3. rm → Remove (delete) — be careful!

    Bash

    Teacher warning: No recycle bin in terminal — deleted = gone forever. Use -i when learning!

Help & Information

  1. man → Manual (help page) for any command
    Bash

    → Press q to quit, / to search inside

  2. –help → Quick help
    Bash

  3. whatis / which
    Bash

Quick Useful Extras (Beginner Friendly)

  1. clear → Clear the screen
    Bash

  2. date → Show current date/time
    Bash

  3. whoami → Who am I logged in as?
    Bash

  4. df -h → Disk free space (human readable)
    Bash

  5. free -h → Memory (RAM) usage
    Bash

  6. history → See past commands
    Bash

Practice Session Right Now (5 Minutes!)

Create a playground:

Bash

See? You just used 10+ commands!

Quick Reference Table (Copy to your notes!)

Command What it does Best example / Option
pwd Show current path pwd
ls List contents ls -la or ls -lah
cd Change folder cd .. , cd ~ , cd folder
mkdir Create folder mkdir -p deep/path
touch Create empty file touch newfile.txt
cat View file content cat file.txt
echo Print text echo “Hi” > file.txt (write to file)
cp Copy cp -r src dest
mv Move / Rename mv old new
rm Delete rm -i file (safe)
man Read manual man cp
date Show date/time date +%F

Master these → next we’ll do pipes (), grep, redirection (> , >>), and small scripts.

Any command confusing? Type it wrong and got error? Tell me — we’ll fix together! Or say: “Teacher, explain ls options more” or “give practice exercises”

You’re doing great — keep typing every day! 🐧🚀 From Hyderabad with love! 😄

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *