Chapter 3: Linux Basic Commands
Practice Questions and Lab Exercises
Come on, practice time! Do every lab on your EC2 – Linux does not come to your hands until you type the commands yourself.
चला, आता प्रॅक्टिस! प्रत्येक लॅब तुमच्या EC2 वर करा – कमांड हाताने टाइप केल्याशिवाय Linux हातात बसत नाही.
चलो, अब प्रैक्टिस! हर लैब अपने EC2 पर करो – कमांड हाथ से टाइप किए बिना Linux हाथ में नहीं बैठता.
- Explain the purpose of
/etc,/var/log,/homeand/usr/share. - What is the difference between absolute and relative paths? Give two examples.
- Convert to numeric:
rwxr-x---,rw-r--r--,r--------. Convert750and640to symbolic. - Why must a
.pemkey have permission400or600? - Write the commands to install
gitandtreeon Ubuntu and on Amazon Linux 2023. - Lab: Create
~/labs/demo/{html,css,js}, createindex.htmlinsidehtml, copy it to/tmp, rename it, then delete it. - Lab: Create user
student1, add it to the admin group of your distribution, switch to it and runsudo whoami. - Lab: Run
sleep 300 &, find its PID withpgrep, and kill it. - Lab: Open a file in vim, add three lines, save and quit. Then do the same in nano.
Quick Revision
- Navigate:
pwd,ls -la,cd. Files:mkdir -p,touch,cp -r,mv,rm -r(permanent!). - View:
cat,less,head,tail -f. - Permissions r=4, w=2, x=1 →
chmod 755dirs,644files,400pem. Ownershipchown user:group. - Users:
useradd -m,passwd,usermod -aG. Admin group:wheel(RHEL/AL) vssudo(Ubuntu). - Packages:
apt(Ubuntu),yum(Amazon Linux / CentOS; runsdnfon newer releases). - Processes:
ps aux,top,kill. Help:man,--help. Editors: nano (easy), vim (i,Esc,:wq).
Got it? Navigation, files, permissions, users and packages – this is the daily work on a server. Now let's move on to the advanced commands – grep, awk, services and cron.
समजलं का? नेव्हिगेशन, फाइल्स, परमिशन्स, यूजर्स आणि पॅकेजेस – हेच सर्व्हरवरचं रोजचं काम आहे. आता पुढे जाऊया ॲडव्हान्स्ड कमांड्सकडे – grep, awk, सर्व्हिसेस आणि cron.
समझ आया? नेविगेशन, फ़ाइलें, परमिशन्स, यूज़र्स और पैकेजेस – यही सर्वर का रोज़ का काम है. अब आगे चलते हैं एडवांस्ड कमांड्स की तरफ़ – grep, awk, सर्विसेस और cron.
Extended teaching notes
Why this lesson matters
Cloud security is mostly IAM, network exposure, logging and secure defaults. The shared responsibility model means the provider patches the metal; you patch what you configure.
- No public databases or public admin panels.
- Roles / OIDC instead of long-lived access keys.
- CloudTrail / Activity Logs / Audit Logs on and retained.
- S3/Blob/GCS: Block Public Access; encrypt; least privilege.
Mini case study
Suppose we are on a purple-team exercise for an Indian mid-size company (sample data). Red notes a technique from this lesson against a lab clone. Blue must show the control that stops it, the log that would have fired, and the ticket that hardens production. That is the standard this course trains you for.
Defender's worksheet (do this today)
- Write the lesson title, date and the exact lab target you are allowed to use.
- List three owned systems (VMs, apps, or cloud accounts) where this lesson applies.
- Run one safe check from the lesson on a lab system only. Paste the command and output.
- Write a two-sentence fix you would give a teammate.
- Name one related public advisory (CERT-In, CISA, NVD, or a vendor bulletin) with its date.
Indian workplace (sample data)
Suppose we are a junior analyst at Infosys, TCS, Wipro or a fintech SOC in Bengaluru/Pune. Turn this lesson into one checklist item with an owner, a due date and a place to store evidence (ticket + screenshot).
Global practice
Compare your notes with OWASP, CIS Benchmarks, NIST CSF/IR guidance or a cloud Well-Architected security question. Write five lines on what overlaps.
Everyday analogy
Explain the risk and the fix to a family member without jargon. If they can repeat the warning, you understand it well enough to teach juniors.
Key terms
- Control: a safeguard (patch, config, process, detection).
- Finding: a weakness backed by evidence.
- Remediation: the fix plus how you verified it.
- Scope: systems you have written permission to touch.
- Least privilege: only the access the task needs.
- Defence in depth: several layers so one failure does not end the story.
Common mistakes
- Skipping written permission "just for a quick scan".
- Practising on hostel, office or public targets without authorisation.
- Collecting tool output without writing the fix.
- Copying attack steps onto production to "verify". Defenders verify with versions, configs and patches.
- Publishing screenshots that contain secrets, cookies or internal hostnames.
Recap
- Evidence, fix, owner, date.
- Own lab only.
- Fix > spectacle.