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 introduction to Linux command-line fundamentals, designed for learners with basic familiarity with Linux systems. The session covers core operating system concepts, including the kernel, shell environments, file system hierarchy, user privileges, and essential command-line tools. Emphasis is placed on hands-on practice, understanding the “everything is a file” paradigm, navigating the filesystem, managing permissions, chaining commands with pipes and redirection, and using manual pages for self-guided learning. The goal is to build foundational competence in Linux for troubleshooting, system interaction, and preparation for more advanced system administration or scripting tasks.

Topic (Timeline)

1. Course Introduction and Linux Fundamentals [00:00:01 - 00:04:45]

The session begins with an overview of the day’s focus: Linux command-line basics for users already familiar with the OS. The trainer emphasizes understanding core concepts to enable effective troubleshooting. Key topics introduced include Linux kernel architecture, shell environments, and the importance of command-line proficiency over GUI tools. The session highlights the flexibility of Linux compared to Windows, noting multiple available shells and graphical interfaces. Participants are encouraged to open terminals using various methods (keyboard shortcut, right-click, menu) to reinforce familiarity with the environment.

2. User Privileges, Terminal Prompts, and System Identification [00:04:48 - 00:13:14]

The trainer explains the distinction between normal user and root privileges, demonstrated by the terminal prompt (dollar sign $ vs. hash #). Participants are guided to use sudo bash to elevate privileges and observe the prompt change, then use exit to return to normal user mode. The concept of “root as a dangerous privilege” is reinforced with the phrase “CV updater.” The session covers identifying the Linux distribution using lsb_release -a and kernel details with uname -a. The uptime command is introduced to check system runtime, establishing baseline system awareness.

3. System Monitoring, Shell Architecture, and the “Everything is a File” Principle [00:13:17 - 00:30:13]

The top command is demonstrated to monitor real-time system performance (CPU, memory, processes). The architecture of Linux is explained: user commands interact with the kernel via a shell, which interfaces with hardware through drivers. The core concept of “everything is a file” is introduced: devices, terminals, and even memory are represented as files in the filesystem. The tty command is used to show that each terminal session is a file under /dev/pts/. The echo command is used to send text to a terminal file, proving that terminals are file endpoints.

4. File System Hierarchy, File Types, and Navigation [00:30:14 - 00:43:14]

The Linux filesystem hierarchy is introduced, centered on the root directory (/). Key directories are explained: /etc (configurations), /bin//sbin (executables), /home (user directories), /var (logs), and /mnt (mount points). The pwd command shows the current directory, and cd / navigates to root. The trainer explains that cd without arguments returns to the home directory, represented by ~. The ls -l command is used to identify file types by the first character: - (regular file), d (directory), c/b (character/block device), l (link). The file command is introduced to determine file type without extensions.

5. Command Structure, Options, Parameters, and Path Types [00:43:19 - 00:52:56]

Commands are broken down into command, option, and argument. Examples include ls -l / and ls -l (defaulting to current directory). The difference between absolute paths (starting with /) and relative paths (relative to current location) is demonstrated. The use of . (current directory) and .. (parent directory) for navigation is shown. The cp command is used to copy files, with . used to specify the current directory as destination. The trainer explains that ~ is a shortcut for the home directory.

6. Aliases, Command Location, and the which Command [00:52:57 - 01:42:22]

The alias command is introduced to create shortcuts (e.g., alias cp='cp -i' to enable interactive overwrite prompts). The temporary nature of aliases is noted, and the unalias command is mentioned. The which command is used to locate the binary path of commands (e.g., which ls/bin/ls), distinguishing user tools (/bin) from administrative tools (/sbin). The trainer demonstrates that bypassing aliases by calling the full path (e.g., /bin/cp) executes the original command without alias interference.

7. User Identity, File Links, and File Types [01:42:23 - 02:00:47]

The whoami and id commands are used to display user identity and group membership. The sudo and whoami commands are contrasted to show that whoami reports the current effective user, while sudo whoami reports root. The ln command is used to create symbolic links (-s) and hard links. The difference is explained: symbolic links point to a filename (break if source is deleted), while hard links are additional directory entries pointing to the same inode (survive source deletion). The file command is used to identify file types (text, executable, etc.), reinforcing that Linux does not rely on file extensions.

8. File Manipulation: Move, Copy, and Remove [02:00:49 - 02:14:05]

The mv command is shown to rename files (if destination doesn’t exist) or move files into directories (if destination is a directory). The cp command is demonstrated with -r for recursive directory copying. The rm command is introduced for deletion, with warnings about its power. The touch command is used to create empty files or update timestamps. The trainer notes that a file and directory cannot share the same name in the same location.

9. Command Chaining, History, and Text File Operations [02:14:08 - 02:31:14]

Multiple commands are chained with ; (e.g., date; whoami). The history command and !n syntax (execute command by number) are introduced for command reuse. Text file viewing commands are covered: cat (output entire file), more (page-by-page), tail (last lines), and head (first lines). The wc command is used to count lines, words, and characters in files. The file command is used to identify file types, and the trainer explains that binary files produce unreadable output when passed to cat.

10. Text Editors, Redirection, and Error Handling [02:31:15 - 03:49:47]

The nano text editor is introduced for editing files, with basic controls (Ctrl+X to exit, Ctrl+O to save). The concept of standard output (stdout, file descriptor 1) and standard error (stderr, file descriptor 2) is explained. Redirection is demonstrated: > to overwrite, >> to append, 2> to redirect errors, and &> to redirect both. The /dev/null device is introduced as a “black hole” to discard output or errors. The tail -f command is used to monitor log files in real time, with a demonstration using two terminals to simulate log entries.

11. Manual Pages, Info Pages, and System Logging [03:49:48 - 04:25:22]

The man command is introduced as the primary help system, with navigation keys (space, b, /search, q). The trainer demonstrates using man -k to search for keywords across all manual pages. The structure of man pages (sections 1–8) is explained, with examples like man 1 passwd (command) vs. man 5 passwd (file). The info system is mentioned as an alternative. The /var/log directory is explored, with tail -f /var/log/syslog shown to monitor system logs. The trainer emphasizes that man pages are distribution-specific and more reliable than online forums.

12. Networking, Portability, and Final Q&A [04:25:23 - 04:38:47]

The ip command is introduced as the modern replacement for ifconfig for network interface management. The trainer explains Linux’s backward compatibility, such as symbolic links preserving old paths (e.g., /lib/usr/lib) to maintain script portability. The session concludes with a Q&A on file permissions: the +x permission bit (visible in ls -l as x) makes a script executable, regardless of file extension. The trainer confirms that extensions (e.g., .sh) are for human readability only. The course ends with a summary of key takeaways and an offer to share reference materials.

Appendix

Key Principles

  • Everything is a file: Devices, terminals, and system resources are represented as files in the filesystem.
  • Shell as interface: The command line is the primary interface to the kernel; GUIs are optional.
  • Root privilege caution: Use sudo only when necessary; avoid prolonged root sessions.
  • Absolute vs. relative paths: Use / for absolute paths; . and .. for relative navigation.
  • File permissions: Execute permission (x) is required to run scripts; extensions are not functional in Linux.

Tools Used

  • Navigation: cd, pwd, ls, ls -l
  • System info: uname -a, lsb_release -a, uptime
  • Process monitoring: top
  • File operations: touch, cp, mv, rm, mkdir
  • File inspection: file, cat, more, tail, head, wc
  • Links: ln -s (symbolic), ln (hard)
  • Redirection: >, >>, 2>, &>, /dev/null
  • Command chaining: ;, | (pipe), grep
  • Help: man, man -k, --help
  • Text editing: nano
  • User/privilege: whoami, id, sudo, su
  • Networking: ip addr

Common Pitfalls

  • Confusing > (overwrite) with >> (append) in redirection.
  • Forgetting to add execute permission (chmod +x) to shell scripts.
  • Using rm -rf without verification, especially as root.
  • Misunderstanding symbolic vs. hard links (deleting source breaks symbolic links).
  • Relying on file extensions to determine file type; use file command instead.
  • Copying commands from online forums without checking distribution or version compatibility.

Practice Suggestions

  • Create a personal lab environment to practice: create files, directories, links, and test permissions.
  • Use ls -l daily to observe file types and permissions.
  • Practice chaining commands: ls /etc | grep .conf | wc -l
  • Use man for every new command; learn to search with / and ?.
  • Set up aliases for frequently used commands (e.g., alias ll='ls -l').
  • Monitor logs with tail -f /var/log/syslog during system changes.
  • Write a simple shell script, make it executable, and run it.