Skip to content

🐧 Chapter 6: The Ultimate Linux Command Lab

This guide combines theory review, sequential hands-on problems, and real-world troubleshooting scenarios. It is designed to take you from a terminal beginner to a confident CLI user.


πŸ—οΈ PART 1: Knowledge & Logic Check (Theory Review)

Test your understanding before touching the keyboard.

πŸ”Ή Section A: Multiple Choice Questions

  1. Which command displays the current logged-in username?
    • A) who
    • B) whoami
    • C) user
    • D) id
  2. Which of the following is an "Absolute Path"?
    • A) Documents/notes.txt
    • B) ../home/student
    • C) /home/student/Desktop
    • D) ./Images
  3. To view long file content page-by-page, which command is best?
    • A) cat
    • B) more
    • C) view
    • D) show
  4. In the permission string -rwxr-xr--, what does the first - represent?
    • A) Directory
    • B) Regular file
    • C) Hidden file
    • D) Executable
  5. Which numeric value represents 'Read' and 'Write' but NO 'Execute'?
    • A) 7
    • B) 5
    • C) 6
    • D) 4

πŸ”Ή Section B: Command Logic

  1. How do you exit the bc (calculator) environment?
  2. Write the command to create nested directories School/Std11/Computer in one go.
  3. Explain why rmdir fails if a directory contains even one hidden file.
  4. If you use cat > myfile.txt on an existing file, what happens to the old data?
  5. What is the difference between the * and ? wildcards?

πŸ’» PART 2: Hands-on Command Lab (50 Problems)

Execute these in your terminal to build muscle memory.

🎯 Level 1: System Awareness (1-7)

  1. Shell Check: Check which shell you are currently using.
  2. Calendar: Display the calendar for January 2024 and the entire year 2024.
  3. Date: Display today's date in mm/dd/yy format.
  4. Calculator: Use bc to calculate 45 * 23 + 17 and find sqrt(625).
  5. Variable: Create a variable "name" and echo "Hello, [name]!".
  6. Cleanup: Clear your terminal screen.
  7. Help: Access the manual for mkdir.

πŸ“‚ Level 2: Directory Operations (8-12)

  1. Structure: Create subfolders math, science, and english inside a folder named studies.
  2. Location: Verify your path with pwd.
  3. Jump: Go back to your home directory from math using a single command.
  4. Remove: Delete the english folder.
  5. Batch: Create temp1 through temp4 simultaneously.

πŸ“„ Level 3: File Operations (13-20)

  1. Create: Use cat > notes.txt to write three lines about Linux.
  2. Display: View the content of notes.txt.
  3. Append: Add "Learning never stops" to the end of notes.txt.
  4. Merge: Concatenate notes.txt and more_notes.txt into all_notes.txt.
  5. Stats: Find the line, word, and character count of all_notes.txt.
  6. Copy: Create a backup_notes.txt from notes.txt.
  7. Rename: Change backup_notes.txt to archived_notes.txt.
  8. Purge: Delete the temp folders and the archived file.

πŸš€ Level 4: Advanced Filters & Wildcards (21-30)

  1. Hidden: List all files including hidden ones.
  2. Secret: Create a file named .secret and see if ls shows it.
  3. Pattern: List all files starting with 'a', 'b', or 'c'.
  4. Slice: Extract the first 10 characters of notes.txt using cut.
  5. CSV: Extract the 1st column from a comma-separated data.txt.
  6. Sort: Sort data.txt by the second field (Age).
  7. Search: Find the line containing "John" in data.txt.
  8. Snippet: Show only the first 2 and last 2 lines of a file.
  9. Compare: Find the differences between two similar text files.
  10. Join: Use paste to join two files horizontally.

πŸ” Level 5: Permissions & Security (31-34)

  1. Status: Check the long-format listing (ls -l) of a script.
  2. CHMOD: Set permissions to 744 (Owner: all, Others: read).
  3. Restrict: Remove your own write permission.
  4. Vault: Create a private directory accessible only to you.

⚑ Level 6: Redirection & Piping (35-40)

  1. Export: Save your directory list to files.txt.
  2. Count: Count how many files are in /bin using a pipe.
  3. Users: Save the top 5 users from /etc/passwd to users.txt.
  4. Bash: Find all users using the bash shell.
  5. Pipeline: Sort data.txt and save it to final.txt.
  6. Transform: Convert a file's text to all UPPERCASE using tr.

πŸ› οΈ Level 7: Troubleshooting (42-50)

  1. Force delete a non-empty directory.
  2. Find a command related to "copy" using apropos.
  3. Identify the owner and group of a system file.
  4. Rename a file that has a space in its name (e.g., my file.txt).
  5. Search for a specific word inside all .txt files in a folder.
  6. Find the differences between config.old and config.new.
  7. Count how many times the word "error" appears in a log file.
  8. See the last 10 commands you typed (Hint: use history).
  9. The Master Pipeline: List β†’ filter .doc β†’ sort β†’ save to list.txt.

πŸ† PART 3: The Capstone Challenges

Complex tasks that require multiple commands to solve.

πŸ”οΈ Challenge 1: The Master Flow Lab

  1. Find your username and current date.
  2. In Home, create Project/Codes and Project/Notes.
  3. Move into Project/Notes.
  4. Create intro.txt, data.txt, and final.doc.
  5. Write "Linux Master" into intro.txt.
  6. Move final.doc into the Codes folder using a relative path.
  7. Copy intro.txt to backup.txt.
  8. Change backup.txt permission to 400.
  9. Go back to Project and delete the Notes folder and everything inside it.

πŸ—οΈ Challenge 2: The Comprehensive Project

  1. The Linux Organizer:
    • Create linux_practice with subfolders documents, scripts, and logs.
    • Create report1.txt and report2.txt inside documents.
    • Merge them into final_report.txt.
    • Create a recursive inventory of the whole project and save it to system_map.txt.
    • Make every file in scripts executable.

πŸ’‘ Final Mentor's Tip

"Commands are like vocabulary. The more you use them in real scenarios, the faster you will speak the language of Linux. Don't just readβ€”type!" πŸ§πŸš€


← Back to Tutorial | Std 11 Index