5 videos 📅 2025-02-18 09:00:00 Africa/Blantyre
4:47:02
2025-02-19 09:20:08
2:39
2025-02-19 21:55:33
1:15:07
2025-02-20 09:31:43
1:28:23
2025-02-20 11:13:37
1:16:38
2025-02-20 13:43:10

Course recordings on DaDesktop for Training platform

Visit NobleProg websites for related course

Visit outline: Ansible for Network Engineers (Course code: ansiblenetwork)

Categories: Ansible

Summary

Overview

This course provides a comprehensive, hands-on introduction to Linux file system fundamentals, command-line operations, and shell environment management. It covers core concepts including file and directory manipulation, symbolic and hard links, text file handling, command aliases, and system auditing. The instructor demonstrates practical commands through live terminal examples, emphasizing real-world use cases for system administration, with a focus on understanding Linux’s file system architecture, permissions, and shell customization.

Topic (Timeline)

1. Introduction to File System Manipulation and Command-Line Basics [00:00:43 - 00:02:24]

  • Begins with a philosophical observation on CAPTCHAs and human-machine identity.
  • Demonstrates creating large files using dd to consume disk space (dd if=/dev/zero of=filename bs=1M count=26).
  • Introduces du -h for human-readable disk usage summary.
  • Emphasizes caution with spaces in Linux commands and introduces ls as a foundational file listing command.

2. Advanced ls Options and Hidden Files [00:02:27 - 00:04:56]

  • Explores ls -l for detailed file attributes (permissions, size, timestamp, type).
  • Introduces ls -t (sort by time), ls -r (reverse order), and other common flags.
  • Explains hidden files (prefixed with .) and demonstrates ls -a to reveal them.
  • Clarifies that hidden files are not inherently special—only their naming convention makes them invisible by default.

3. File System Structure and Naming Constraints [00:05:01 - 00:07:14]

  • Demonstrates that a file and directory cannot share the same name in the same location.
  • Introduces concepts of absolute vs. relative paths and parent (..) and current (.) directories.
  • Explains how to identify mount points and check filesystem size.
  • Introduces id to display user and group IDs, and whoami to show the current logged-in user.

4. User Context, Privilege Escalation, and System Accounting [00:07:17 - 00:10:14]

  • Distinguishes between whoami (effective user) and who am I (real user).
  • Demonstrates switching to root via sudo bash and the difference between effective and real user context.
  • Explains that standard commands do not log user switching—system-level accounting (e.g., lastlog, auditd) is required for true auditing.
  • Notes that time command measures execution duration, not system time.

5. Network Fundamentals and Historical Context [00:10:16 - 00:12:52]

  • Explains ICMP type codes: Type 8 for Echo Request, Type 0 for Echo Reply.
  • Shares historical context: pre-TCP/IP networks (IPX/SPX, X.400/X.500) and the rise of the internet.
  • Mentions early networking experience (1994) and evolution of protocols.

6. File System Navigation and Basic Operations [00:12:54 - 00:16:50]

  • Reviews cd, pwd, and ls for navigation.
  • Demonstrates touch to create empty files and mkdir -p to create nested directory structures (e.g., backup/logs/general).
  • Instructs learners to replicate directory structure for consistency in subsequent exercises.

7. File Copying, Overwriting, and the “Layer 8” Joke [00:16:53 - 00:19:51]

  • Uses cp to copy single and multiple files (wildcard *.conf).
  • Explains that cp does not copy directories by default; requires -r (recursive).
  • Highlights that cp overwrites without warning by default.
  • Introduces humorous “Layer 8” concept: user error (between chair and desk).
  • Demonstrates cp -i for interactive overwrite prompts.

8. File Movement and Renaming with mv [00:19:54 - 00:23:45]

  • Explains that mv performs both move and rename based on destination existence:
    • Destination does not exist → rename.
    • Destination is a directory → move into it.
  • Demonstrates with mv fileX BKP (where BKP is a directory) → file moved into BKP.
  • Confirms file disappearance from source location after move.

9. File and Directory Deletion with rm [00:25:25 - 00:28:26]

  • Uses rm to delete files.
  • Shows that rm cannot delete non-empty directories directly.
  • Uses rm -r to recursively delete directory contents.
  • Introduces rmdir for safe deletion of empty directories only.

10. Symbolic and Hard Links [00:29:08 - 00:39:21]

  • Creates symbolic (soft) link with ln -s source link and demonstrates its behavior:
    • Shows link target in ls -l output.
    • Link becomes broken if source is deleted.
  • Introduces hard links with ln source link (no -s):
    • No visual distinction in ls -l; inode count increases.
    • Hard link persists even if original file is deleted.
    • Multiple hard links point to same inode (same data, multiple names).
  • Uses analogy: one room (inode) with multiple doors (hard links); closing one door doesn’t block access.

11. Terminal Session Logging with script [00:39:56 - 00:40:41]

(Note: This segment is interrupted by unrelated audio, but resumes at 00:54:24)

  • Introduces script filename to log all terminal input/output to a file.
  • Demonstrates exit to stop logging and cat to review the log.
  • Notes utility for auditing, training, or documentation.

12. Text File Editing and Reading Tools [00:54:30 - 01:17:32]

  • Introduces text editors: nano (user-friendly) and vi (powerful, terminal-based).
  • Demonstrates creating and saving a file with nano (Ctrl+X → Save).
  • Explains file command to verify file type (e.g., text, binary).
  • Compares cat (output entire file) with more (page-by-page viewing).
  • Demonstrates more search (/pattern), help (h), and inline shell execution (!command).
  • Introduces tail (bottom-up view), head (top lines), and tail -n 5 / head -n 5.
  • Explains wc (word count) to count lines, words, and characters in text.

13. Shell Environment and Command Aliases [01:17:35 - 01:27:19]

  • Explains which to locate command binaries (e.g., which cp/usr/bin/cp).
  • Notes that system tools are in /usr/bin, admin tools in /sbin.
  • Demonstrates creating a persistent alias: alias cp='cp -i' to enable interactive overwrite.
  • Clarifies that aliases are terminal-session-specific unless saved in shell config files (e.g., ~/.bashrc).
  • Shows alias without arguments to list existing aliases (e.g., ls=ls --color=auto).
  • Introduces unalias to remove an alias.

Appendix

Key Principles

  • File System as Hierarchy: Everything is a file; directories are special files.
  • Inode-Based Storage: Hard links share the same inode; symbolic links are pointers.
  • Command Behavior Depends on Context: mv renames or moves based on destination existence.
  • Shell as Programmable Environment: Aliases, functions, and config files (e.g., .bashrc) customize behavior.
  • Auditing Requires System-Level Tools: whoami ≠ audit trail; use auditd or logs for accountability.

Tools Used

  • dd, du -h, ls -l, ls -a, touch, mkdir -p, cp, cp -i, cp -r, mv, rm, rmdir, ln -s, ln, script, nano, vi, cat, more, head, tail, wc, which, id, whoami, alias, unalias

Common Pitfalls

  • Overwriting files with cp without -i.
  • Assuming rm -r is safe without checking contents.
  • Confusing symbolic links with hard links (deleting source breaks soft links).
  • Believing whoami logs user switching—requires system accounting.
  • Using spaces incorrectly in alias definitions: alias cp=cp -i (wrong) vs. alias cp='cp -i' (correct).

Practice Suggestions

  • Create a test directory structure and practice cp -r, mv, and rm -r.
  • Create both symbolic and hard links to the same file; delete the original and observe behavior.
  • Use script to log a session, then review the log.
  • Set up a personal alias (e.g., alias ll='ls -la') and add it to ~/.bashrc to make it permanent.
  • Use wc -l /etc/passwd to count users on the system.
  • Use more /etc/passwd and search for a username with /username.