Div | ||
---|---|---|
| ||
System Information |
Understanding your system's hardware and software configuration
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
uname -a # Displays kernel version and system architecture. lscpu # Provides detailed information about the CPU. lsblk # Lists all available block devices. lsusb # Shows USB devices connected to the system. uptime # Shows how long the system has been running and load averages.Load average reflects the average number of processes waiting to run or use CPU resources over different time intervals, typically 1, 5, and 15 minutes. |
Div | ||
---|---|---|
| ||
CPU and Memory Diagnostics |
Monitoring CPU and memory usage helps in identifying performance bottlenecks.
...
htop is an interactive system monitor process viewer and process manager. It is designed as an alternative to the Unix program top. It shows a frequently updated list of the processes running on a computer, normally ordered by the amount of CPU usage.
Installation: on Ubuntu or Debian-based systems via command apt install htop or sudo yum install htop on CentOS
Code Block | ||||
---|---|---|---|---|
| ||||
Code Block | ||||
| ||||
htop |
vmstat -s # Provides a detailed breakdown of memory usage and other related metrics since the last system boot.
...
Code Block | ||||
---|---|---|---|---|
| ||||
mpstat Linux 5.15.0-112-generic (testhost) 06/21/24 _x86_64_ (1 CPU) 10:37:12 CPU %usr %nice %sys %iowait %irq %soft %steal %guest %gnice %idle 10:37:12 all 1.68 0.11 1.38 0.14 0.00 0.04 1.16 0.00 0.00 95.49 |
Div | ||
---|---|---|
| ||
Disk Usage and Health |
Keeping track of disk usage and health is crucial for preventing data loss and ensuring efficient storage management.
...
Code Block | ||||
---|---|---|---|---|
| ||||
iostat Linux 5.15.0-112-generic (testhost) 06/21/24 _x86_64_ (1 CPU) avg-cpu: %user %nice %system %iowait %steal %idle 1.68 0.11 1.41 0.14 1.16 95.50 |
Div | ||
---|---|---|
| ||
Process and Service Management |
Managing processes and services is essential for maintaining system stability.
...
Code Block | ||||||
---|---|---|---|---|---|---|
| ||||||
systemctl restart service_name # Restarts a service. systemctlIf enablea service_name is #not Enablesbehaving acorrectly, servicestopped toresponding, startrestarting atit boot. kill -9 process_id(PID) # Forces termination of a process. (No output unless there is an error, the process is terminated forcefully) |
Div | ||
---|---|---|
| ||
Logs and Monitoring |
Analyzing logs and monitoring system activities can help in identifying issues and tracking system performance.
Linux log files are stored in plain-text and can be found in the /var/log directory
Code Block | ||||
---|---|---|---|---|
| ||||
tail /var/log/syslog # Shows the last part of the logs, where problems usually lie. |
Essential Linux Log Files:
1. System logs:
/var/log/syslog or /var/log/messages - Stores all activity data across the global system. Activity for Redhat-based (CentOS or Rhel) stored in messages, while Debian-based (Ubuntu) systems are stored in syslog.
/var/log/dmesg
dmesg allows reviewing messages stored in the Linux ring buffer, providing insights into hardware errors and startup issues. How To Use dmesg
can often resolve the issue without needing a full system reboot. Also, when you modify a service config file, using systemctl restart applies the changes immediately.
systemctl enable service_name # Enables a service to start at boot.
kill -9 process_id(PID) # Forces termination of a process.
#(No output unless there is an error, the process is terminated forcefully) |
Div | ||
---|---|---|
| ||
Logs and Monitoring |
Analyzing logs and monitoring system activities can help in identifying issues and tracking system performance.
Linux log files are stored in plain-text and can be found in the /var/log directory
Code Block | ||||
---|---|---|---|---|
| ||||
journalctl -f # will show you the latest system logs and keep updating the display with new log entries as they are created, which is useful for monitoring live system activity. |
Essential Linux Log Files:
1. System logs:
/var/log/syslog or /var/log/messages - Stores all activity data across the global system. Activity for Redhat-based (CentOS or Rhel) stored in messages, while Debian-based (Ubuntu) systems are stored in syslog.
/var/log/dmesg
dmesg allows reviewing messages stored in the Linux ring buffer, providing insights into hardware errors and startup issues. How To Use dmesg
Code Block | ||||
---|---|---|---|---|
| ||||
dmesg -T
[Wed May 29 14:46:00 2024] Run /init as init process
[Wed May 29 14:46:00 2024] with arguments:
[Wed May 29 14:46:00 2024] /init
[Wed | ||||
Code Block | ||||
| ||||
dmesg -T
[Wed May 29 14:46:00 2024] Run /init as init process
[Wed May 29 14:46:00 2024] with arguments:
[Wed May 29 14:46:00 2024] /init
[Wed May 29 14:46:00 2024] with environment:
[Wed May 29 14:46:00 2024] HOME=/
[Wed May 29 14:46:00 2024] TERM=linux
[Wed May 29 14:46:00 2024] BOOT_IMAGE=/boot/vmlinuz-5.15.0-97-generic
[Wed May 29 14:46:00 2024] biosdevname=0
[Wed May 29 14:46:00 2024] netcfg/do_not_use_netplan=true
[Wed May 29 14:46:00 2024] piix4_smbus 0000:00:01.3: SMBus Host Controller at 0x700, revision 0 |
...
/var/log/apache2/ - Apache HTTP server logs (access, error).
/var/log/mysql/ - MySQL database server logs.
5. Package Management Logs:
/var/log/apt directory - contains several log files that provide important information about apt-related activities on Debian-based systems(access, error).
/var/log/mysql/yum.log - Red Hat-based systems store the yum and dnf package manager logs, file provides information about the results of a specific command, such as any errors or warnings that were generated. For example, if a package update fails
6. Event Logs:
var/log/wtmp - Records of user logins and logouts.
var/log/lastlog - Information about the last logins for all users. This binary file can be read by command lastlog.
...
language | bash |
---|---|
theme | Midnight |
title | Commands |
...
- MySQL database server logs.
5. Package Management Logs:
/var/log/apt directory - contains several log files that provide important information about apt-related activities on Debian-based systems.
/var/log/yum.log - Red Hat-based systems store the yum and dnf package manager logs, file provides information about the results of a specific command, such as any errors or warnings that were generated. For example, if a package update fails
6. Event Logs:
var/log/wtmp - Records of user logins and logouts.
var/log/lastlog - Information about the last logins for all users. This binary file can be read by command lastlog.
CSS Stylesheet |
---|
.home-banner { background: #459df0; color: #fff; font-size: 20px; padding: 20px; } .home-banner h2 { color: #fff; } .title-box { border: 1px none #459df0; padding: 10px; } .title-box > h2 { background: #459df0; bottom: 10px; color: #fff; margin-left: -10px; margin-right: -10px; padding: 2px 10px; position: relative; } |
...