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 session provides a foundational introduction to Linux system navigation, file system structure, and core terminal concepts. The instructor guides learners through understanding terminal prompts, user privileges (normal user vs. root), system information commands, and the fundamental Linux principle that “everything is a file.” The session covers file types (regular files, directories, device files, symbolic links), path navigation (absolute vs. relative), and essential commands like pwd, cd, ls -l, du, and df. Practical demonstrations include checking system distribution, kernel version, network configuration, and file permissions, with emphasis on avoiding common pitfalls and understanding the underlying architecture rather than surface-level usage.
Topic (Timeline)
1. Terminal Setup and User Privileges [00:00:00 - 00:04:14]
- Instructor guides participants to open three terminal windows and adjust display settings (e.g., full screen, zoom via Ctrl+).
- Explains the terminal prompt:
username@hostname:current_directory$— indicating current user, host, and location. - Clarifies that the
$symbol denotes a normal (non-root) user, while#(hash) indicates superuser privileges. - Demonstrates switching to root via
sudo bashand warns of the risks of root access (“one mistake can wipe your system”). - Notes that multiple methods exist to elevate privileges (e.g.,
sudo su), butsudo bashis used for demonstration.
2. System Information and Environment Discovery [00:04:19 - 00:14:08]
- Teaches how to identify the Linux distribution using
lsb_release -a(Ubuntu in this case). - Introduces key system commands:
uname -rto check kernel version.uptimeto see system runtime.whoandwho -ato list logged-in users (local and remote).wto display active users and their processes.hostnameto retrieve system name.
- Demonstrates network configuration using
ip a(modern) andifconfig(legacy, distribution-dependent). - Emphasizes that command availability and syntax vary across distributions (e.g., Ubuntu vs. older Unix systems).
3. The Linux File System: “Everything is a File” [00:18:26 - 00:28:14]
- Introduces the core Linux concept: “everything is a file” — including hardware devices, processes, and directories.
- Demonstrates this using:
tty→ returns/dev/pts/X, a device file representing the terminal.echo hello > /dev/pts/X→ sends text to another terminal (file I/O).
- Compares file types using
ls -l:-= regular file (e.g., text, binary).c= character device (e.g., terminal, serial port).b= block device (e.g., disk drives).d= directory (also a file).l= symbolic link (shortcut).
- Shows
/binas a symbolic link to/usr/binfor backward compatibility.
4. File System Hierarchy and Navigation [00:28:16 - 00:57:38]
- Explores root (
/) directory structure:/bin,/etc,/home,/proc,/var,/opt,/tmp. - Explains
/etcas the central configuration directory (e.g.,/etc/hosts). - Compares Linux hierarchy to Windows (e.g.,
/etc/hosts≈C:\Windows\System32\drivers\etc\hosts). - Introduces navigation commands:
pwd→ print working directory.cd /→ go to root.cd(no args) → go to home directory.~(tilde) → shorthand for home directory.cd ..→ move up one level.cd -→ toggle between last two directories.
- Teaches absolute paths (start with
/) vs. relative paths (based on current location). - Demonstrates tab completion to reduce typing and avoid errors.
5. File Operations, Permissions, and Disk Usage [00:57:40 - 01:14:35]
- Demonstrates file creation with
touchand copying withcp(source and destination required; no defaults). - Explains
.(current directory) and..(parent directory) as path components. - Introduces
du -shto calculate directory size (e.g.,du -sh /home/student). - Contrasts
ls -l(shows directory size as 4K) withdu(shows actual content size). - Uses
df -hto display disk usage across mounted filesystems in human-readable format. - Demonstrates creating a test file with
dd(e.g.,dd if=/dev/zero of=bigfile bs=500 count=50→ 25KB file). - Warns about the power and danger of
dd— can overwrite critical data if misused.
Appendix
Key Principles
- Everything is a file: Devices, directories, and processes are represented as files in the filesystem.
- No file extensions: File type is determined by content, not extension (e.g.,
.txtis a convention, not a system rule). - Use
ls -lto identify file types: First character indicates type (-,d,l,c,b). - Absolute vs. Relative Paths: Absolute starts with
/; relative is based on current location. - Tilde (
~) = home directory;.= current directory;..= parent directory;cd -= toggle last directory.
Tools Used
lsb_release -a— distribution infouname -r— kernel versionwho,w,uptime— user and system statusip a,ifconfig— network configtty— current terminal devicecd,pwd,ls,cp,touch— navigation and file opsdu -sh— directory sizedf -h— disk usagedd— low-level file creation (advanced)
Common Pitfalls
- Confusing
ls -ldirectory size (always 4K) with actual content size → usedu. - Assuming
cpdefaults to current directory — must explicitly specify destination. - Using
ifconfigon modern systems where it’s deprecated; preferip. - Running
sudo bashorddwithout understanding consequences. - Relying on file extensions to determine type — use
filecommand (implied) orls -linstead.
Practice Suggestions
- Open multiple terminals and send messages between them using
echo "text" > /dev/pts/X. - Navigate the full filesystem: start at root, move to
/etc,/home,/bin, and back. - Use
ls -l /devto identify device files and classify them (cvsb). - Create a test file with
ddand measure its size withdu -h. - Practice path navigation: from
/home/userto/binusing both absolute and relative paths.