Add tech_docs/linux/linux_cpu_info.md
This commit is contained in:
37
tech_docs/linux/linux_cpu_info.md
Normal file
37
tech_docs/linux/linux_cpu_info.md
Normal file
@@ -0,0 +1,37 @@
|
||||
### Basic CPU Information Commands
|
||||
|
||||
1. **`nproc`**
|
||||
- Displays the number of processing units available to the current process. This might be less than the total number of CPUs if limitations are imposed (e.g., in a container).
|
||||
- Example: `nproc`
|
||||
|
||||
2. **`lscpu`**
|
||||
- Provides detailed information about the CPU architecture, such as the number of CPUs, cores per socket, threads per core, and more. It's part of the `util-linux` package.
|
||||
- Example: `lscpu`
|
||||
|
||||
3. **`cat /proc/cpuinfo`**
|
||||
- Displays detailed CPU information by reading the `/proc/cpuinfo` file, which contains data about all CPU cores. Shows details like processor ID, vendor ID, CPU family, model, model name, stepping, microcode, CPU MHz, cache size, and more.
|
||||
- Example: `cat /proc/cpuinfo`
|
||||
|
||||
### Advanced and Specific Information Commands
|
||||
|
||||
4. **`top` or `htop`**
|
||||
- Both are interactive process viewers which can also show CPU usage per core in real-time. `htop` provides a more user-friendly interface and additional features compared to `top`.
|
||||
- Example: `top` or `htop`
|
||||
|
||||
5. **`vmstat`**
|
||||
- Reports information about processes, memory, paging, block IO, traps, disks, and CPU activity. The CPU section gives a breakdown of the time spent in various states, including user, system, and idle.
|
||||
- Example: `vmstat 1`
|
||||
|
||||
6. **`mpstat`**
|
||||
- Part of the `sysstat` package, this command is used to display statistics about CPU usage per processor, including usage in user mode, system mode, and idle time.
|
||||
- Example: `mpstat -P ALL 1`
|
||||
|
||||
7. **`dmesg` | grep -i cpu**
|
||||
- `dmesg` displays the kernel ring buffer messages. When piped with `grep -i cpu`, it can be used to find CPU-related messages, including initialization and configuration information.
|
||||
- Example: `dmesg | grep -i cpu`
|
||||
|
||||
8. **`cpuid`**
|
||||
- Provides detailed information about the CPU(s) using the CPUID instruction to find out everything the CPU reports about itself.
|
||||
- Example: `cpuid`
|
||||
|
||||
These commands form a solid foundation for exploring CPU characteristics and performance on Linux systems. They can be particularly helpful for system administration, performance tuning, and troubleshooting.
|
||||
Reference in New Issue
Block a user