Skip to main content
Unlisted page
This page is unlisted. Search engines will not index it, and only users having a direct link can access it.

Chapter 6: Basic Ubuntu Linux Commands 🐧

Mentor's Note: In Linux, the Terminal is your magic wand. While most people use a mouse to click icons (GUI), power users and developers use the Command Line (CLI) to talk directly to the computer's soul. It's faster, more powerful, and once you master it, you'll feel like a wizard! 🧙‍♂️


🌟 The Scenario: The Universal Translator 🗣️

Imagine you are visiting a foreign country. You can point at things (GUI), but it's much more efficient if you speak the local language (CLI).

  • The Shell: This is your Translator. You give it a command in English-like words, and it translates them into "0s and 1s" for the computer's CPU.
  • The Terminal: This is the Microphone you use to speak to the translator.
  • The Result: Total control over the computer without ever needing a mouse! ✅

📖 Main Topics Covered

  1. Starting Up the Terminal
  2. Shells in Linux
  3. Command Syntax
  4. General Purpose Commands
  5. Working with Directories
  6. Working with Files
  7. Manipulating Files and Directories
  8. File Permissions
  9. I/O Redirection and Piping
  10. Filters

🎨 Visual Logic: The Shell Architecture


🐚 Understanding Shells

A Shell is a command-line interpreter.

  • Available Shells: Use cat /etc/shells to see all shells installed.
  • Default Shell: Use echo $SHELL to see your default (usually /bin/bash).
  • Switching Shells: Type csh to enter C Shell, exit to return.
  • Internal vs External: Use type [command] to check if a command is built-in or a separate program.

🛠️ Complete Command Reference

📅 1. General Purpose Commands

CommandPurposeLogic/Example
calDisplay calendarcal 01 2024 (Specific month)
dateDisplay system datedate +%D (Date), date +%T (Time)
bcCommand line calculatorUse bc -l for precision math
echoDisplay message/variableecho "Hello $USER"
passwdChange passwordpasswd (Self) or passwd user
clearClear terminal screenWipes previous output

📂 2. Help & Help Systems

CommandPurposeExample
--helpBrief help flagmv --help
manFull manual pagesman ls
whatisOne-line descriptionwhatis cat
aproposSearch by keywordapropos copy

📂 3. Directory Management

CommandPurposeExample
pwdPrint working directoryShows absolute path 📍
mkdirCreate directorymkdir -p a/b/c (Nested)
cdChange directorycd ~ (Home), cd - (Back)
rmdirRemove empty folderrmdir old_docs

📄 4. File Operations

CommandPurposeDetails
catCreate/View/Concatcat > f (New), cat >> f (Append)
rmRemove file/folder-i (Ask), -r (Recursive), -f (Force)
lsList contents-a (Hidden), -l (Long), -t (Time)
cpCopy datacp file1 file2
mvMove or Renamemv old.txt new.txt
morePagingView files one page at a time
wcWord count-l (Lines), -w (Words), -c (Chars)

🔍 5. File Analysis & Comparison

CommandPurposeExample
cmpCompare two filesFinds first byte of difference
diffShow differencesShows exactly what lines differ
grepPattern matchinggrep "Surat" address.txt

🔐 File Permissions

Linux uses a 3-part system: User (u), Group (g), and Others (o).

Octal Values

  • 4: Read (r)
  • 2: Write (w)
  • 1: Execute (x)
  • 0: None (-)

Common Modes:

  • 777: Everyone can do everything (Insecure! ⚠️)
  • 755: Owner can write, everyone else can only read/run.
  • 644: Owner can write, everyone else read only.

🔍 Wildcard Characters (The Search Shortcuts)

  • * : Any number of characters (including none).
  • ? : Exactly one character.
  • [abc] : Any one of a, b, or c.
  • [!abc] : Any character except a, b, or c.
  • [p-s] : Any character in the range p to s.

⚡ I/O Redirection & Piping

SymbolActionAnalogy
>Redirection (Overwrite)Pouring water into a new bucket 🪣
>>Redirection (Append)Adding water to an existing bucket 🚰
<Input RedirectionSucking water from a bucket 🥤
|PipeConnecting two pipes together 🔗

🧪 Filter Commands (The Sifters)

Filters take input, process it, and output the result.

  • head -n: Show first n lines.
  • tail -n: Show last n lines.
  • cut: Vertical slicing. cut -d "," -f 1 (Get 1st field of CSV).
  • paste: Join files side-by-side.
  • sort: Sort lines (use -r for reverse).
  • tr: Translate characters. cat f | tr 'a' 'A'.

🎯 Practice & Implementation

The best way to learn Linux is by doing. We have prepared a comprehensive 50-problem practice set for you.

Go to Chapter 6 Practice Sheet →


💡 Interview & Board Tip 👔

"Board examiners love asking about Case Sensitivity. Remember: MyFile.txt and myfile.txt are two different files in Linux! Also, always know the difference between rm (files) and rmdir (folders)."


← Back to Std 11 Overview

📍 Visit Us

🏫 VD Computer Tuition Surat

VD Computer Tuition
📍 Address
2/66 Faram Street, Rustompura
Surat395002, Gujarat, India
📞 Phone / WhatsApp
+91 84604 41384
🌐 Website

Computer Classes & Tuition — Areas We Serve in Surat

AdajanAlthanAmroliAthwaAthwalinesBhagalBhatarBhestanCanal RoadChowkCitylightDumasGaurav PathGhod Dod RoadHaziraJahangirpuraKamrejKapodraKatargamLimbayatMagdallaMajura GateMota VarachhaNanpuraNew CitylightOlpadPalPandesaraParle PointPiplodPunaRanderRing RoadRustampuraSachinSalabatpuraSarthanaSosyo CircleUdhnaVarachhaVed RoadVesuVIP Road
📞 Call Sir💬 WhatsApp Sir