Course Content
🗓️ Day 1 – Getting Started with Linux
• Understand what Linux is and why it’s essential for DevOps and AI. • Learn basic terminal commands: pwd, ls, cd. • Explore the filesystem hierarchy and directory structure. • Practice moving around the shell confidently.
0/6
🗓️ Day 2 – Working with Files and Directories
• Create, view, and edit files using touch, cat, nano. • Organize directories with mkdir, rmdir, cp, mv. • Understand absolute vs. relative paths. • Hands‑on: build a mini project folder structure.
0/6
🗓️ Day 3 – Permissions and Ownership
• Learn how Linux manages read, write, and execute permissions. • Commands: chmod, chown, chgrp. • Understand user roles (root, user, group). • Practice fixing permission errors and securing files.
0/6
🗓️ Day 4 – Processes and Services
• Understand what processes are and how to monitor them. • Commands: ps, top, kill, systemctl. • Learn how services start, stop, and restart. • Hands‑on: manage a simple service like nginx or ssh.
0/6
🗓️ Day 5 – Networking and Remote Access
• Basics of IP addresses, ports, and protocols. • Commands: ping, ip, ssh, scp. • Learn secure remote connections and file transfers. • Practice connecting to a remote server.
0/6
🗓️ Day 6 – Shell Scripting Essentials
• Introduction to shell scripting and variables. • Write simple scripts using echo, loops, and conditionals. • Learn how to make scripts executable. • Hands‑on: automate a daily task (e.g., backup or log cleanup).
0/6
Introduction to the Linux Terminal

In the previous section, we learned how to use cat to peek inside a file. While cat is excellent for short documents containing five or ten lines, it has a fatal flaw: it is completely blind to file size.

If you try to use cat on a massive system log file containing 50,000 lines of data, it will instantly flood your terminal screen, scroll at lightning speed past your eyes, and erase your scrollback history. Even worse, on a real server, running cat on a multi-gigabyte file can cause the terminal to freeze or crash due to memory overload.

To read large files and system logs safely and intelligently, you need three precision tools: less, head, and tail.

1. Navigating Large Files Safely: less

Think of less as an interactive, read-only viewing window. Unlike cat, less does not load the entire file into memory at once. It only loads exactly what fits on your screen, making it incredibly fast and safe for massive data dumps.

  • Command Syntax: less /var/log/syslog

The moment you run this, the text file opens in a controlled view mode. Your prompt disappears, and you can navigate the document at your own pace using simple keyboard shortcuts:

  • Arrow Keys / Page Up / Page Down: Scroll through the file line-by-line or page-by-page.

  • Spacebar: Advance forward by one full screen.

  • / (Forward Slash): Enter search mode. Type a keyword (e.g., /error) and press Enter to jump straight to that word.

  • q (Quit): Exit the viewer instantly and return safely to your standard prompt line.

Why is it called less? There is an old, classic terminal viewer tool called more. Because more could only scroll forward through a document, hackers wrote a better tool that allowed users to scroll backward as well. They proudly declared “less is more”—and the name stuck.

2. Checking the Top of a File: head

Sometimes you don’t care about the entire file; you just want to verify the structural format or read the headers at the very beginning. For this, we use the head command.

  • Command Syntax: head config.conf

By default, head will look at the target file, slice out exactly the first 10 lines, print them to your screen, and stop.

If you want to view a specific number of lines, you can override the default using the -n (number) option toggle:

  • head -n 5 config.conf (Prints only the first 5 lines).

3. Monitoring System Logs: tail

In cloud engineering and DevOps, the tail command is easily one of the most frequently used tools in your entire arsenal. While head looks at the top, tail looks at the very bottom of a file.

  • Command Syntax: tail /var/log/nginx/error.log

By default, tail spits out exactly the last 10 lines of a file. This is crucial because when an application crashes or errors out, the most relevant troubleshooting clues are always appended to the very end of the log file. Like head, you can specify a line count using tail -n 30.

The DevOps Superpower: tail -f

Imagine you are trying to debug a live website error. You want to see errors printed on your screen the exact second a user clicks a broken button.

If you pass the -f (follow) option toggle, tail will lock onto the file, keep the connection live, and actively stream new lines of text to your screen in real time as the system writes them.

  • Live Streaming Command: tail -f /var/log/syslog

Your terminal will remain open and waiting. The moment an event occurs on the server, a new line will pop up dynamically. To break out of this live loop and close the stream, simply press Ctrl + C.

Summary Checklist: Which Tool When?

Scenario Best Command to Use Why?
Quick verify of a 3-line file cat filename Fast, lightweight, doesn’t trap you in a viewer.
Reading a massive 50MB log book less filename Saves memory, allows keyword searching, easy q exit.
Looking at initial configuration headers head filename Snaps only the very top of the file layout.
Checking the absolute latest error crash message tail filename Jumps instantly to the bottom where new data is written.
Watching server traffic arrive live tail -f filename Actively streams live data updates to your screen in real time.