Course 4 - Learning Linux Shell Scripting | Episode 8: System Monitoring, Performance Measurement, and Log Management
In this lesson, you’ll learn about:
Resource monitoring & optimization:
Using df and du to calculate disk usage and free space, display results in human-readable form (-H), summarize totals, exclude directories, and locate the largest files with du | sort.
Tracking disk I/O activity with iotop in both interactive and script modes.
Checking filesystem integrity using fsck, with options to simulate or automatically repair issues.
Measuring and tuning system power usage with powertop, generating HTML reports, and adjusting power-saving settings.
Performance measurement & process analysis:
Measuring command execution time via time, interpreting Real, User, and System times, and formatting or appending output to files.
Monitoring process activity with ps to track CPU and memory usage, including automated scripts to identify the top resource-consuming processes.
Continuously observing system output using watch, with difference highlighting (-d) between updates.
System status & user activity tracking:
Viewing logged-in users (who, w, users), uptime, and load averages.
Reviewing login history with last (reads /var/log/wtmp) and failed logins with lastb.
Analyzing session logs to calculate each user’s total activity time, login count, and ranking by usage.
Logging techniques & management:
Writing custom system log messages using logger, which integrates with syslogd and system-wide log files (boot, kernel, authentication, mail, etc.).
Monitoring file and directory activity with inotifywait to detect read, write, create, move, or delete events.
Managing log file growth using logrotate, setting parameters for size limits, rotation intervals (daily/weekly), and archived copy counts, with optional compression.
Security & health monitoring scripts:
Implementing intrusion detection by scanning /var/log/auth.log for repeated failed login attempts, extracting attacker details (user, IP, count) within a time window.
Automating remote health checks using SSH to gather disk usage data from multiple hosts, logging device stats and marking alerts for disks above 80% usage.
Key outcome: Gain proficiency in maintaining Linux system stability and security by actively monitoring performance, automating diagnostics, and managing logs efficiently through shell scripting.
You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy
Course 4 - Learning Linux Shell Scripting | Episode 8: System Monitoring, Performance Measurement, and Log Management
In this lesson, you’ll learn about:
Resource monitoring & optimization:
Using df and du to calculate disk usage and free space, display results in human-readable form (-H), summarize totals, exclude directories, and locate the largest files with du | sort.
Tracking disk I/O activity with iotop in both interactive and script modes.
Checking filesystem integrity using fsck, with options to simulate or automatically repair issues.
Measuring and tuning system power usage with powertop, generating HTML reports, and adjusting power-saving settings.
Performance measurement & process analysis:
Measuring command execution time via time, interpreting Real, User, and System times, and formatting or appending output to files.
Monitoring process activity with ps to track CPU and memory usage, including automated scripts to identify the top resource-consuming processes.
Continuously observing system output using watch, with difference highlighting (-d) between updates.
System status & user activity tracking:
Viewing logged-in users (who, w, users), uptime, and load averages.
Reviewing login history with last (reads /var/log/wtmp) and failed logins with lastb.
Analyzing session logs to calculate each user’s total activity time, login count, and ranking by usage.
Logging techniques & management:
Writing custom system log messages using logger, which integrates with syslogd and system-wide log files (boot, kernel, authentication, mail, etc.).
Monitoring file and directory activity with inotifywait to detect read, write, create, move, or delete events.
Managing log file growth using logrotate, setting parameters for size limits, rotation intervals (daily/weekly), and archived copy counts, with optional compression.
Security & health monitoring scripts:
Implementing intrusion detection by scanning /var/log/auth.log for repeated failed login attempts, extracting attacker details (user, IP, count) within a time window.
Automating remote health checks using SSH to gather disk usage data from multiple hosts, logging device stats and marking alerts for disks above 80% usage.
Key outcome: Gain proficiency in maintaining Linux system stability and security by actively monitoring performance, automating diagnostics, and managing logs efficiently through shell scripting.
You can listen and download our episodes for free on more than 10 different platforms: https://linktr.ee/cybercode_academy