0% found this document useful (0 votes)
17 views34 pages

Updated - The Complete Linux Reference Guide

The document is a comprehensive guide to Linux, covering essential modules on file management, system information, networking, process management, and user/group management. Each module includes learning objectives, commands, and practice exercises to enhance user proficiency. The guide is structured to facilitate both learning and practical application of Linux commands and concepts.

Uploaded by

cypherphage
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views34 pages

Updated - The Complete Linux Reference Guide

The document is a comprehensive guide to Linux, covering essential modules on file management, system information, networking, process management, and user/group management. Each module includes learning objectives, commands, and practice exercises to enhance user proficiency. The guide is structured to facilitate both learning and practical application of Linux commands and concepts.

Uploaded by

cypherphage
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 34

The Complete Linux Reference

Guide

By: OutDatedBiskut
Document Contents

Document Contents

Module 1: File Management Essentials .................................................................................................. 5

Learning objectives: ............................................................................................... 5


Commands covered: .............................................................................................. 5
Practice Exercise:................................................................................................... 7
Module 2: System Information and Monitoring ....................................................................................... 8

Learning objectives: ............................................................................................... 8


Commands covered: .............................................................................................. 8
Practice Exercise:................................................................................................... 9
Module 3: Networking Tools and Techniques ........................................................................................ 10

Learning objectives: ............................................................................................. 10


Commands covered: ............................................................................................ 10
Practice Exercise:................................................................................................. 11
Module 4: Process Management ......................................................................................................... 12

Learning objectives: ............................................................................................. 12


Commands covered: ............................................................................................ 12
Practice Exercise:................................................................................................. 13
Module 5: User and Group Management .............................................................................................. 14

Learning objectives: ............................................................................................. 14


Commands covered: ............................................................................................ 14
Practice Exercise:................................................................................................. 15
Module 6: Package Management ......................................................................................................... 16

Learning objectives: ............................................................................................. 16


Commands covered: ............................................................................................ 16
Practice Exercise:................................................................................................. 17
Module 7: Text Processing and Manipulation ........................................................................................ 18

Learning objectives: ............................................................................................. 18

2|Page
Document Contents

Commands covered: ............................................................................................ 18


Practice Exercise:................................................................................................. 20
Module 8: Disk Management ............................................................................................................... 21

Learning objectives: ............................................................................................. 21


Commands covered: ............................................................................................ 21
Practice Exercise:................................................................................................. 22
Module 9: File Permissions and Ownership .......................................................................................... 23

Learning objectives: ............................................................................................. 23


Commands covered: ............................................................................................ 23
Practice Exercise:................................................................................................. 23
Module 10: Compression and Archiving ............................................................................................... 24

Learning objectives: ............................................................................................. 24


Commands covered: ............................................................................................ 24
Practice Exercise:................................................................................................. 25
Module 11: Environment Variables and Shell Configuration ................................................................... 26

Learning objectives: ............................................................................................. 26


Commands covered: ............................................................................................ 26
Practice Exercise:................................................................................................. 26
Module 12: Shell Scripting Essentials .................................................................................................. 27

Learning objectives: ............................................................................................. 27


Commands covered: ............................................................................................ 27
Practice Exercise:................................................................................................. 27
Module 13: System Logs and Monitoring .............................................................................................. 28

Learning objectives: ............................................................................................. 28


Commands covered: ............................................................................................ 28
Practice Exercise:................................................................................................. 29
Module 14: File Comparison and Merging ............................................................................................ 30

Learning objectives: ............................................................................................. 30


Commands covered: ............................................................................................ 30
Practice Exercise:................................................................................................. 31

3|Page
Document Contents

Module 15: System Exploration Tools ................................................................................................... 32

Learning objectives: ............................................................................................. 32


Commands covered: ............................................................................................ 32
Practice Exercise:................................................................................................. 32
Final Project: Linux System Administration Toolkit ................................................................................ 33
Honorable and worthy mentions ......................................................................................................... 34

~An old saying goes like, "Drop by drop, a river is formed" — the same goes for knowledge.
Don't let technical words intimidate you ;)

4|Page
Module 1: File Management Essentials

Module 1: File Management Essentials


Learning objectives: Navigate the Linux filesystem confidently and manage files and
directories efficiently.

Commands covered:
ls - Lists directory contents, showing files and folders in the current directory. Using -l shows
details like permissions and size, -a shows hidden files, and -h shows file sizes in human-
readable format.

• Usage: ls [options] [directory]

• Key options: -l (long format), -a (all files including hidden), -h (human-readable


sizes)

• Example: ls -la ~ lists all files in your home directory with details

cd - Changes your current directory location. Use cd ~ to go to home directory, cd / for root,
and cd .. to move up one directory.

• Usage: cd [directory]

• Special references: .. (parent directory), / (root), ~ (home)

• Example: cd /home/user/documents

pwd - Prints the full path of your current working directory, showing exactly where you are in
the filesystem.

• Usage: pwd

• Example: pwd shows your current location in the filesystem

cp - Copies files or directories from one location to another. The -r option copies directories
recursively including all contents.

• Usage: cp [options] source destination

• Key options: -r (recursive for directories), -v (verbose output)

• Example: cp -r projects backup/ copies a directory recursively

5|Page
Module 1: File Management Essentials

mv - Moves or renames files and directories. It works both for relocating files and for
changing filenames.

• Usage: mv [options] source destination

• Key options: -i (interactive, prompt before overwrite)

• Example: mv file.txt /new/location/

rm - Removes (deletes) files or directories. Be careful with -rf which forces removal of
directories and their contents without confirmation.

• Usage: rm [options] file

• Key options: -r (recursive), -f (force without confirmation)

• Example: rm -rf temp_dir removes directory and contents

mkdir - Creates new directories. The -p option creates parent directories as needed.

• Usage: mkdir [options] directory

• Key options: -p (create parent directories if needed)

• Example: mkdir -p projects/web/css

rmdir - Removes empty directories only (will fail if directory contains files).

• Usage: rmdir directory

• Example: rmdir empty_dir

touch - Creates empty files or updates timestamps on existing files.

• Usage: touch file

• Example: touch newfile.txt

ln - Creates links between files. The -s option creates symbolic links (shortcuts) rather than
hard links.

• Usage: ln [options] target link_name

• Key options: -s (symbolic link)

• Example: ln -s /path/to/file shortcut

6|Page
Module 1: File Management Essentials

find - Searches for files and directories based on various criteria like name, size, or type.

• Usage: find [path] [options]

• Key options: -name (by name), -type (by type, e.g., f for file)

• Example: find . -name "*.txt" finds all text files in current directory

Practice Exercise: Create a directory structure for a web project with folders for HTML,
CSS, and JavaScript files. Practice creating, moving, and linking files within this structure.

7|Page
Module 2 : System Information and Monitoring

Module 2: System Information and Monitoring


Learning objectives: Retrieve and analyze information about your system's hardware,
software, and performance.

Commands covered:
uname Displays system information like kernel version and hardware architecture.

• Usage: uname [options]

• Key options: -a (all details)

• Example: uname -a displays kernel version and system architecture

hostname - Shows or sets the system's network name.

• Usage: hostname

• Example: hostname displays your computer's name

whoami - Displays the username of the current user.

• Usage: whoami

• Example: whoami shows the current user

df - Reports disk space usage for mounted filesystems, showing available and used space.

• Usage: df [options]

• Key options: -h (human-readable), -T (filesystem type)

• Example: df -h shows disk usage in GB/MB

du - Estimates file and directory space usage, helping identify what's taking up disk space.

• Usage: du [options] [directory]

• Key options: -h (human-readable), -s (summary)

• Example: du -sh /home shows total size of home directory

free - Shows memory usage, including free and used RAM and swap space.

• Usage: free [options]

• Key options: -h (human-readable), -s (update every x seconds)

• Example: free -h shows RAM usage in GB/MB

8|Page
Module 2 : System Information and Monitoring

top - Monitors system processes in real-time, showing CPU, memory usage, and running
processes.

• Usage: top [options]

• Key options: -u (filter by user)

• Example: top displays live system resource usage

htop - An improved interactive version of top with a more user-friendly interface.

• Usage: htop

• Example: htop provides a more user-friendly interface than top

uptime - Shows how long the system has been running and the current load average.

• Usage: uptime

• Example: uptime displays how long system has been running

lscpu - Displays detailed information about the CPU architecture.

• Usage: lscpu

• Example: lscpu shows detailed processor information

lsblk - Lists all block devices (like hard drives and their partitions).

• Usage: lsblk [options]

• Key options: -f (file system info)

• Example: lsblk -f shows disks with filesystem details

Practice Exercise: Write a simple script that collects system information including CPU
model, memory usage, disk space, and system uptime, then formats the output in a
readable report.

9|Page
Module 3: Networking Tools and Techniques

Module 3: Networking Tools and Techniques


Learning objectives: Configure network connections, troubleshoot connectivity issues,
and transfer data securely.

Commands covered:
ping - Tests connectivity to another host by sending data packets and measuring response
time.

• Usage: ping [options] host

• Key options: -c (count of pings)

• Example: ping -c 4 google.com sends 4 pings to Google

ifconfig - Configures network interfaces (older command, being replaced by « ip »).

• Usage: ifconfig [interface]

• Example: ifconfig eth0 shows ethernet interface details

ip - Modern tool for viewing and managing network configuration.

• Usage: ip [object] [command]

• Objects: addr, link, route, etc.

• Example: ip addr show displays all network interfaces

netstat - Shows network connections, routing tables, and interface statistics.

• Usage: netstat [options]

• Key options: -tuln (TCP, UDP, listening, numeric)

• Example: netstat -tuln shows listening ports

ss - Displays socket statistics, similar to netstat but faster.

• Usage: ss [options]

• Key options: -tuln (TCP, UDP, listening, numeric)

• Example: ss -tuln shows open ports (modern replacement for netstat)

10 | P a g e
Module 3: Networking Tools and Techniques

ssh - Securely connects to remote systems for command-line access.

• Usage: ssh [options] user@host

• Key options: -p (port), -i (identity file)

• Example: ssh user@192.168.1.100 connects to remote server

scp - Securely copies files between hosts over SSH.

• Usage: scp [options] source destination

• Key options: -r (recursive), -P (port)

• Example: scp file.txt user@remote:/path/

wget - Downloads files from the web via HTTP, HTTPS, or FTP.

• Usage: wget [options] URL

• Key options: -O (output file), -q (quiet)

• Example: wget http://example.com/file

curl - Transfers data to or from servers using various protocols, with more options than
wget.

• Usage: curl [options] URL

• Key options: -o (output file), -X (request method)

• Example: curl -o file.html http://example.com

traceroute - Shows the network path packets take to reach a destination host.

• Usage: traceroute host

• Example: traceroute google.com shows network path to Google

Practice Exercise: Set up SSH key-based authentication for secure passwordless login
to a remote server. Then create a script that downloads a file from the web and uploads it
to your remote server.

11 | P a g e
Module 4: Process Management

Module 4: Process Management


Learning objectives: Monitor and control running processes effectively to maintain
system performance.

Commands covered:
ps - Lists running processes. The aux option shows all processes with detailed information.

• Usage: ps [options]

• Key options: aux (all processes), -ef (full format)

• Example: ps aux shows all processes with details

kill - Terminates processes by their process ID (PID).

• Usage: kill [signal] PID

• Key signals: -9 (SIGKILL, force kill), -15 (SIGTERM, graceful)

• Example: kill -9 1234 forcefully terminates process 1234

killall - Terminates processes by name rather than PID.

• Usage: killall [options] name

• Key options: -9 (force kill)

• Example: killall firefox terminates all Firefox processes

pkill - Kills processes based on name and other attributes.

• Usage: pkill [options] pattern

• Key options: -u (user), -f (full command line match)

• Example: pkill -u user kills all processes owned by user

pgrep - Finds process IDs by name without killing them.

• Usage: pgrep [options] pattern

• Key options: -l (list names), -u (user)

• Example: pgrep -l firefox finds Firefox process IDs with names

12 | P a g e
Module 4: Process Management

nice - Starts a command with modified scheduling priority.

• Usage: nice [options] command

• Key options: -n (priority level, -20 to 19)

• Example: nice -n 10 ./script.sh runs script with lower priority

renice - Changes the priority of already running processes.

• Usage: renice [priority] -p PID

• Example: renice +5 -p 1234 reduces priority of running process

bg - Resumes suspended jobs in the background.

• Usage: bg [job_id]

• Example: bg %1 continues job 1 in background

fg - Brings background jobs to the foreground.

• Usage: fg [job_id]

• Example: fg %1 brings job 1 to foreground

jobs - Lists all background jobs.

• Usage: jobs

• Example: jobs displays all background jobs

Practice Exercise: Write a script that monitors CPU usage of specific applications and
alerts you when usage exceeds 80% for more than one minute. Include options to
automatically adjust the priority of resource-intensive processes

13 | P a g e
Module 5: User and Group Management

Module 5: User and Group Management


Learning objectives: Create and manage system users and groups with appropriate
permissions and security.

Commands covered:
useradd - Creates a new user account.

• Usage: useradd [options] username

• Key options: -m (create home directory), -s (set shell)

• Example: useradd -m -s /bin/bash newuser

userdel - Deletes a user account.

• Usage: userdel [options] username

• Key options: -r (remove home directory)

• Example: userdel -r olduser

usermod - Modifies user account properties.

• Usage: usermod [options] username

• Key options: -aG (add to groups), -s (change shell)

• Example: usermod -aG sudo newuser adds user to sudo group

passwd - Changes user passwords.

• Usage: passwd [username]

• Example: passwd newuser sets password for newuser

groupadd - Creates a new group.

• Usage: groupadd [options] groupname

• Key options: -g (specify GID)

• Example: groupadd developers

14 | P a g e
Module 5: User and Group Management

groupdel - Deletes a group.

• Usage: groupdel groupname

• Example: groupdel oldgroup

su - Switches to another user account temporarily.

• Usage: su [options] [username]

• Key options: - (use login shell)

• Example: su - root switches to root with login shell

sudo - Executes commands as another user (typically the superuser).

• Usage: sudo [command]

• Example: sudo apt update runs command as superuser

Practice Exercise: Set up a shared project environment where multiple users belong to
the same group and can collaboratively edit files in a shared directory. Configure
permissions to ensure security while enabling collaboration.

15 | P a g e
Module 6: Package Management

Module 6: Package Management


Learning objectives: Install, update, and remove software efficiently across different
Linux distributions.

Commands covered:
apt - Package management tool for Debian-based distributions (Ubuntu, Mint).

• Usage: apt [command] [package]

• Key commands: update, upgrade, install, remove

• Example: apt install vim installs Vim editor

yum - Package manager for Red Hat-based distributions (older versions).

• Usage: yum [command] [package]

• Key commands: install, remove, update

• Example: yum install httpd installs Apache webserver

dnf - Package manager for Fedora/CentOS 8+

• Usage: dnf [command] [package]

• Key commands: install, remove, update

• Example: dnf install git installs Git

pacman - Package manager for Arch Linux.

• Usage: pacman [options] [package]

• Key options: -S (install), -R (remove), -Syu (update)

• Example: pacman -S vim installs Vim editor

snap - Universal package management system for Linux.

• Usage: snap [command] [package]

• Key commands: install, remove, refresh

• Example: snap install spotify installs Spotify

16 | P a g e
Module 6: Package Management

flatpak - Another universal package management system focused on sandboxed


applications.

• Usage: flatpak [command] [package]

• Key commands: install, uninstall, update

• Example: flatpak install flathub org.videolan.VLC

Practice Exercise: Create a script that automatically installs your preferred software
environment on a fresh Linux installation. Include error handling and checks to ensure
compatibility with multiple distributions.

17 | P a g e
Module 7: Text Processing and Manipulation

Module 7: Text Processing and Manipulation


Learning objectives: View, edit, and manipulate text files efficiently using powerful
command-line tools.

Commands covered:
cat - Concatenate and display files

• Usage: cat [options] file

• Key options: -n (number lines)

• Example: cat -n file.txt displays file with line numbers

less - Views file contents with scrolling and search capabilities.

• Usage: less file

• Navigation: / (search), q (quit), space (next page)

• Example: less /var/log/syslog views system log

more - Similar to less but with more basic functionality.

• Usage: more file

• Example: more file.txt

head - Display the first lines of a file

• Usage: head [options] file

• Key options: -n (number of lines)

• Example: head -n 5 file.txt shows first 5 lines

tail - Shows the end (last lines) of a file. The -f option lets you follow file updates in real-
time.

• Usage: tail [options] file

• Key options: -n (number of lines), -f (follow)

• Example: tail -f /var/log/syslog shows live log updates

18 | P a g e
Module 7: Text Processing and Manipulation

grep - Searches for text patterns in files using regular expressions.

• Usage: grep [options] pattern [file]

• Key options: -i (case-insensitive), -r (recursive)

• Example: grep -r "error" /var/log finds error messages

sed - Stream editor for text manipulation

• Usage: sed [options] 'command' file

• Key options: -i (edit in place)

• Example: sed 's/old/new/g' file.txt replaces text

awk - Powerful text processing tool for extracting and manipulating data.

• Usage: awk [options] 'pattern {action}' file

• Key options: -F (field separator)

• Example: awk '{print $1}' file.txt prints first column

cut - Extract sections from lines

• Usage: cut [options] file

• Key options: -d (delimiter), -f (fields)

• Example: cut -d: -f1 /etc/passwd extracts usernames

sort - Sort lines of text

• Usage: sort [options] file

• Key options: -r (reverse), -n (numeric sort)

• Example: sort -n numbers.txt sorts numerically

uniq - Report or omit repeated lines

• Usage: uniq [options] file

• Key options: -c (count occurrences)

• Example: uniq -c file.txt counts duplicate lines

19 | P a g e
Module 7: Text Processing and Manipulation

Practice Exercise: Process a large log file to extract specific information, sort it, count
occurrences, and generate a summary report. Create a pipeline that combines multiple
text processing commands.

20 | P a g e
Module 8: Disk Management

Module 8: Disk Management


Learning objectives: Manage disks, partitions, and file systems effectively for optimal
performance and data storage.

Commands covered:
fdisk - Partition table manipulator

• Usage: fdisk [options] device

• Key options: -l (list partitions)

• Example: fdisk -l /dev/sda shows disk partitions

parted - Disk partitioning tool

• Usage: parted [options] device

• Example: parted /dev/sda print shows partition table

mkfs - Create a file system

• Usage: mkfs [options] device

• Key options: -t (type, e.g., ext4)

• Example: mkfs -t ext4 /dev/sdb1 formats partition

mount - Mount a file system

• Usage: mount [options] device directory

• Key options: -t (type), -o (options)

• Example: mount /dev/sdb1 /mnt

umount - Unmount a file system

• Usage: umount directory

• Example: umount /mnt

lsblk - List block devices

• Usage: lsblk [options]

• Key options: -f (file system info)

21 | P a g e
Module 8: Disk Management

• Example: lsblk -f shows disks with filesystem details

blkid - Display block device attributes

• Usage: blkid [device]

• Example: blkid /dev/sda1 shows partition UUID

Practice Exercise: Create a script that automates the process of partitioning a new disk,
formatting it with an appropriate file system, and mounting it with optimal parameters.
Include error checking and validation.

22 | P a g e
Module 9: File Permissions and Ownership

Module 9: File Permissions and Ownership


Learning objectives: Secure files and directories with appropriate permissions and
ownership settings.

Commands covered:
chmod - Change file permissions

• Usage: chmod [options] mode file

• Modes: numeric (755) or symbolic (u+x)

• Example: chmod 755 script.sh makes script executable

chown - Change file ownership

• Usage: chown [options] user:group file

• Key options: -R (recursive)

• Example: chown -R user:group /dir changes ownership recursively

chgrp - Change group ownership

• Usage: chgrp [options] group file

• Key options: -R (recursive)

• Example: chgrp -R group /dir

umask - Set default permissions for new files

• Usage: umask [mask]

• Example: umask 022 sets default permissions

Practice Exercise: Set up a secure file sharing system where different users have
appropriate access levels to specific directories. Document the permission structure and
justify your choices.

23 | P a g e
Module 10: Compression and Archiving

Module 10: Compression and Archiving


Learning objectives: Compress, decompress, and archive files efficiently for storage
and transfer.

Commands covered:
tar - Archive files

• Usage: tar [options] archive_file files

• Key options: -c (create), -x (extract), -f (file), -z (gzip), -j (bzip2)

• Example: tar -czvf archive.tar.gz /dir creates compressed archive

gzip - Compress files

• Usage: gzip [options] file

• Key options: -d (decompress), -k (keep original)

• Example: gzip file.txt compresses file

gunzip - Decompress .gz files

• Usage: gunzip [options] file.gz

• Key options: -k (keep original)

• Example: gunzip file.txt.gz restores original file

zip - Create ZIP archives

• Usage: zip [options] archive.zip files

• Key options: -r (recursive), -q (quiet)

• Example: zip -r archive.zip /dir creates zip archive

unzip - Extract ZIP archives

• Usage: unzip [options] archive.zip

• Key options: -l (list contents)

• Example: unzip archive.zip extracts all files

24 | P a g e
Module 10: Compression and Archiving

Practice Exercise: Create a backup system that uses compression to efficiently store
daily, weekly, and monthly backups with rotation. Compare the efficiency of different
compression methods for various file types.

25 | P a g e
Module 11: Environment Variables and Shell Configuration

Module 11: Environment Variables and Shell Configuration


Learning objectives: Configure your shell environment for optimal productivity and
workflow.

Commands covered:
export - Set environment variables

• Usage: export VAR=value

• Example: export PATH=$PATH:/new/path adds directory to PATH

env - Display or run a command in a modified environment

• Usage: env [options] [command]

• Key options: -i (ignore inherited environment)

• Example: env shows all environment variables

echo $VAR - Display the value of an environment variable

• Usage: echo $VAR

• Example: echo $PATH shows PATH variable

source - Execute commands from a file in the current shell

• Usage: source file

• Example: source ~/.bashrc reloads configuration

alias - Create shortcuts for commands

• Usage: alias name='command'

• Example: alias ll='ls -la' creates shortcut for ls

unalias - Remove aliases

• Usage: unalias name

• Example: unalias ll removes alias

Practice Exercise: Create a customized shell environment with productivity-enhancing


configurations, including colored prompts, useful aliases, and environment variables.
Make these settings persistent across login sessions.

26 | P a g e
Module 12: Shell Scripting Essentials

Module 12: Shell Scripting Essentials


Learning objectives: Develop effective shell scripts for automation and system
administration.

Commands covered:
test or [ - Evaluate conditional expressions

• Usage: [ expression ]

• Expressions: -f (file exists), -d (directory exists)

• Example: [ -f file.txt ] && echo "Exists"

expr - Evaluate expressions (arithmetic, string, etc.)

• Usage: expr expression

• Example: expr 2 + 3 performs addition

seq - Generate a sequence of numbers

• Usage: seq [options] first increment last

• Key options: -s (separator), -w (equal width)

• Example: seq -s ", " 1 2 10 outputs "1, 3, 5, 7, 9"

basename - Strip directory and suffix from filenames

• Usage: basename path

• Example: basename /path/to/file.txt outputs "file.txt"

dirname - Strip the last component from a file path

• Usage: dirname path

• Example: dirname /path/to/file.txt outputs "/path/to"

Practice Exercise: Create a utility script that processes command-line arguments and
performs operations on files or directories. Include error handling, help messages, and
proper exit codes.

27 | P a g e
Module 13: System Logs and Monitoring

Module 13: System Logs and Monitoring


Learning objectives: Access and analyze system logs and performance metrics to
troubleshoot issues.

Commands covered:
dmesg - Print kernel ring buffer messages

• Usage: dmesg [options]

• Key options: -w (follow new messages)

• Example: dmesg -w shows live kernel messages

journalctl - Query and display systemd logs

• Usage: journalctl [options]

• Key options: -f (follow), -u (unit/service)

• Example: journalctl -u ssh shows SSH service logs

vmstat - Report virtual memory statistics

• Usage: vmstat [options]

• Key options: -s (summary), -d (disk stats)

• Example: vmstat 1 updates every second

iostat - Report CPU and I/O statistics

• Usage: iostat [options]

• Key options: -c (CPU only), -d (disk only)

• Example: iostat -d shows disk I/O stats

mpstat - Report per-CPU statistics

• Usage: mpstat [options]

• Key options: -P (specify CPU)

• Example: mpstat -P 0 shows stats for CPU 0

28 | P a g e
Module 13: System Logs and Monitoring

sar - Collect and report system activity

• Usage: sar [options]

• Key options: -u (CPU), -r (memory)

• Example: sar -u 1 5 shows CPU usage for 5 seconds

lsof - List open files and processes using them

• Usage: lsof [options]

• Key options: -i (network), -u (user)

• Example: lsof -i :80 shows processes using port 80

Practice Exercise: Create a monitoring script that collects system metrics over time,
alerts on abnormal conditions, and generates daily reports on system performance and
resource usage.

29 | P a g e
Module 14: File Comparison and Merging

Module 14: File Comparison and Merging


Learning objectives: Compare and merge different versions of files efficiently.
Commands covered:
diff - Compare files line by line

• Usage: diff [options] file1 file2

• Key options: -u (unified format), -r (recursive)

• Example: diff -u file1.txt file2.txt shows unified diff

cmp - Compare two files byte by byte

• Usage: cmp [options] file1 file2

• Key options: -l (list differing bytes)

• Example: cmp file1 file2

comm - Compare two sorted files line by line

• Usage: comm [options] file1 file2

• Key options: -1 (suppress first file), -2 (suppress second)

• Example: comm file1 file2

sdiff - Side-by-side comparison of files

• Usage: sdiff [options] file1 file2

• Key options: -w (output width)

• Example: sdiff file1 file2

patch - Apply a diff file to an original

• Usage: patch [options] original < diff_file

• Key options: -p (strip leading directories)

• Example: patch original.txt < patch.diff

30 | P a g e
Module 14: File Comparison and Merging

Practice Exercise: Create a simple version control system that tracks changes to
configuration files, allows reverting to previous versions, and shows differences between
versions

31 | P a g e
Module 15: System Exploration Tools

Module 15: System Exploration Tools


Learning objectives: Find and locate files, commands, and resources on your system
efficiently.

Commands covered:
whereis - Locate the binary, source, and manual for a command

• Usage: whereis [options] command

• Key options: -b (binary only)

• Example: whereis ls shows ls binary location

which - Show the full path of a command

• Usage: which [options] command

• Key options: -a (all matches)

• Example: which python shows path to Python

locate - Quickly find files by name (uses a database)

• Usage: locate [options] pattern

• Key options: -i (case-insensitive)

• Example: locate -i document finds files with "document" in name

Practice Exercise: Create a script that builds a searchable database of useful command
examples from your personal usage history, allowing you to quickly find commands you've
used before.

32 | P a g e
Final Project: Linux System Administration Toolkit

Final Project: Linux System Administration Toolkit


Objective: Combine everything you've learned to create a comprehensive system
administration toolkit.

Requirements:

1. Create a modular script collection that addresses key administration tasks

2. Include tools for monitoring system health and performance

3. Implement user and permission management utilities

4. Create backup and recovery tools

5. Include network diagnostics and security checks

6. Design a menu-driven interface for easy access

7. Document your toolkit with usage examples

Deliverables:

• Complete source code for all scripts

• Installation and usage instructions

• Documentation for each component

• Test cases demonstrating functionality

This project showcases your linux skills commands and your ability to solve real-world
system administration problems.

33 | P a g e
Honorable and worthy mentions

Honorable and worthy mentions


• OverTheWire.org : has a set of games that you could play while still learning. For
starters, I would recommend the Bandit series:
https://overthewire.org/wargames/bandit/
Within this series of exercises, you're putting into practice a bunch of important,
real-world skills—navigating the command line, understanding basic file
permissions, poking at services, and generally learning to think like someone who
breaks things to understand how they work.

It’s not spoon-fed, and that’s the point. You’ll Google a lot. You’ll fail a bit. That’s
how you know you’re learning. If you can make it through Bandit and still want more,
the other "Wargames" on the site ramp up fast and furious. Start with curiosity,
finish with competence.

• DistroWatch.com : if you’re trying to wrap your head around the Linux ecosystem,
this is your radar. It tracks hundreds of active (and defunct) Linux and BSD
distributions, giving you the lowdown on who’s doing what, when, and how. From
release dates to package managers and desktop environments, it’s a central hub to
compare distros before diving in. The Page Hit Ranking gives a decent pulse on
what’s trending. Whether you aree distro-hopping or just distro-curious, this is
where you start mapping the terrain if you are completely new.

• https://www.linuxfromscratch.org/ : This is where you go when you’re tired of


holding hands and want to build your own distro from source. Teaches you how a
Linux system really works—dependency by dependency.

• https://explainshell.com/ :Paste in a complicated shell command, and it breaks it


down argument by argument. Feels like cheating, but it's a killer tool for learning the
shell instead of just copying and pasting.

• https://catonmat.net/books : A series that teaches you to wield bash like a scalpel.


Not just command snippets—these are tactics.

• r/linux & r/linux4noobs : might lose some karma along the way, but you’ll find
community tips, distro drama, and the occasional gold nugget. Great for staying
plugged into the culture.

34 | P a g e

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy