Update tech_docs/linux/linux_show.md
This commit is contained in:
@@ -53,3 +53,117 @@
|
|||||||
- **vmstat**: Provides detailed information on system processes, memory, paging, block I/O, traps, and CPU activity.
|
- **vmstat**: Provides detailed information on system processes, memory, paging, block I/O, traps, and CPU activity.
|
||||||
- **iostat**: Provides CPU and I/O statistics, useful for identifying bottlenecks.
|
- **iostat**: Provides CPU and I/O statistics, useful for identifying bottlenecks.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
# Comprehensive Linux System Information Commands
|
||||||
|
|
||||||
|
## General System Information
|
||||||
|
- **hostnamectl**: Displays system hostname and identification data
|
||||||
|
- **lsb_release -a**: Provides LSB (Linux Standard Base) information about the distribution
|
||||||
|
- **cat /etc/os-release**: Shows operating system information (name, version, ID)
|
||||||
|
- **uname -n**: Displays the system's network node hostname
|
||||||
|
|
||||||
|
## Kernel and System Version
|
||||||
|
- **cat /proc/version**: Shows Linux kernel version and compilation details
|
||||||
|
- **uname -a**: Displays comprehensive system information (kernel, architecture, hostname)
|
||||||
|
- **uname -r**: Shows kernel release version
|
||||||
|
- **uname -v**: Displays kernel version with build timestamp
|
||||||
|
- **dmesg | grep -i linux**: Shows boot messages containing kernel information
|
||||||
|
|
||||||
|
## System Uptime and Performance
|
||||||
|
- **uptime**: Shows system uptime and load averages (1, 5, 15 minutes)
|
||||||
|
- **w**: Displays logged-in users and their activity plus system uptime
|
||||||
|
- **cat /proc/loadavg**: Raw load average data
|
||||||
|
- **nproc**: Shows number of available processing units
|
||||||
|
|
||||||
|
## Hardware Information
|
||||||
|
- **lscpu**: Detailed CPU architecture and feature information
|
||||||
|
- **lsblk**: Lists block devices (drives, partitions) in tree format
|
||||||
|
- **lsblk -f**: Includes filesystem information for block devices
|
||||||
|
- **lspci**: Lists PCI devices (graphics cards, network adapters, etc.)
|
||||||
|
- **lspci -v**: Verbose PCI device information
|
||||||
|
- **lsusb**: Lists connected USB devices
|
||||||
|
- **lsusb -v**: Verbose USB device details
|
||||||
|
- **dmidecode**: Hardware information from BIOS/UEFI (requires root)
|
||||||
|
- **dmidecode -t system**: System manufacturer and model info
|
||||||
|
- **free -h**: Memory usage in human-readable format
|
||||||
|
- **cat /proc/meminfo**: Detailed memory statistics
|
||||||
|
- **lshw**: Comprehensive hardware information (may require installation)
|
||||||
|
- **inxi -Fxz**: System overview including hardware and software (requires installation)
|
||||||
|
|
||||||
|
## Storage and Filesystem Information
|
||||||
|
- **df -h**: Disk space usage in human-readable format
|
||||||
|
- **df -i**: Inode usage statistics
|
||||||
|
- **du -h /path**: Directory space usage
|
||||||
|
- **du -sh /path**: Summary of directory size
|
||||||
|
- **lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT**: Detailed block device info
|
||||||
|
- **findmnt**: Shows mounted filesystems in tree format
|
||||||
|
- **blkid**: Lists block device UUIDs and filesystem types
|
||||||
|
|
||||||
|
## Network Information
|
||||||
|
- **ip addr show**: Current IP addresses and network interfaces
|
||||||
|
- **ip link show**: Network interface details and status
|
||||||
|
- **ip route show**: Routing table information
|
||||||
|
- **ss -tuln**: Listening sockets (TCP/UDP) - modern netstat replacement
|
||||||
|
- **ss -tulpn**: Includes process information for listening sockets
|
||||||
|
- **netstat -tuln**: Traditional socket listing (often deprecated)
|
||||||
|
- **netstat -rn**: Routing table (traditional command)
|
||||||
|
- **iwconfig**: Wireless interface configuration (if available)
|
||||||
|
|
||||||
|
## Process and Service Information
|
||||||
|
- **ps aux**: All running processes with resource usage
|
||||||
|
- **ps -ef**: Alternative process listing format
|
||||||
|
- **top**: Real-time process monitor (press 'q' to quit)
|
||||||
|
- **htop**: Enhanced interactive process viewer (requires installation)
|
||||||
|
- **pstree**: Process tree showing parent-child relationships
|
||||||
|
- **pgrep -l pattern**: Find processes by name pattern
|
||||||
|
- **pidof process_name**: Get PID of specific process
|
||||||
|
- **systemctl list-units --type=service**: Active systemd services
|
||||||
|
- **systemctl status service_name**: Specific service status
|
||||||
|
|
||||||
|
## System Monitoring and Performance
|
||||||
|
- **vmstat 1 5**: Virtual memory statistics (1-second intervals, 5 samples)
|
||||||
|
- **iostat 1 5**: I/O statistics for devices
|
||||||
|
- **iotop**: Real-time I/O usage by process (requires installation)
|
||||||
|
- **pidstat 1 5**: Per-process statistics
|
||||||
|
- **sar**: System activity reporter (part of sysstat package)
|
||||||
|
- **mpstat**: Multi-processor usage statistics
|
||||||
|
|
||||||
|
## Logs and System Messages
|
||||||
|
- **dmesg | less**: Kernel ring buffer messages
|
||||||
|
- **dmesg -T**: Kernel messages with human-readable timestamps
|
||||||
|
- **journalctl -xe**: Recent systemd journal entries with explanations
|
||||||
|
- **journalctl -f**: Follow journal in real-time
|
||||||
|
- **journalctl -u service_name**: Logs for specific service
|
||||||
|
- **tail -f /var/log/syslog**: Follow system log (on systems using syslog)
|
||||||
|
|
||||||
|
## Environment and Configuration
|
||||||
|
- **env**: Display environment variables
|
||||||
|
- **printenv**: Alternative to display environment variables
|
||||||
|
- **cat /proc/cmdline**: Kernel boot parameters
|
||||||
|
- **lsmod**: List loaded kernel modules
|
||||||
|
- **systemctl list-unit-files**: All systemd unit files and their states
|
||||||
|
- **crontab -l**: Current user's scheduled tasks
|
||||||
|
- **sudo crontab -l**: Root user's scheduled tasks
|
||||||
|
|
||||||
|
## Quick System Overview Commands
|
||||||
|
```bash
|
||||||
|
# One-liner system summary
|
||||||
|
uname -a && uptime && free -h && df -h
|
||||||
|
|
||||||
|
# Hardware overview
|
||||||
|
lscpu && free -h && lsblk
|
||||||
|
|
||||||
|
# Network quick check
|
||||||
|
ip addr show && ss -tuln
|
||||||
|
|
||||||
|
# Process overview
|
||||||
|
ps aux --sort=-%cpu | head -10
|
||||||
|
```
|
||||||
|
|
||||||
|
## Tips for Usage
|
||||||
|
- Use `--help` or `man command_name` for detailed options
|
||||||
|
- Many commands support `-h` for human-readable output
|
||||||
|
- Root privileges may be required for some hardware information commands
|
||||||
|
- Consider installing additional tools like `htop`, `iotop`, `inxi` for enhanced functionality
|
||||||
|
- Combine commands with pipes for filtered output: `ps aux | grep process_name`
|
||||||
Reference in New Issue
Block a user