Cheatsheet: Difference between revisions

Content added Content deleted
Line 862: Line 862:
== Check CPU, Memory and HDD ==
== Check CPU, Memory and HDD ==


;CPU
=== CPU ===


* CPU Info
; CPU Info
lscpu
lscpu
lshw -C CPU
lshw -C CPU
Line 874: Line 874:
cat /proc/cpuinfo | grep processor | wc -l
cat /proc/cpuinfo | grep processor | wc -l


*The number of processors shown by /proc/cpuinfo might not be the actual number of cores on the processor.
* The number of processors shown by /proc/cpuinfo might not be the actual number of cores on the processor.
For example a processor with 2 cores and hyperthreading would be reported as a processor with 4 cores.
* For example a processor with 2 cores and hyperthreading would be reported as a processor with 4 cores.
* If there are 4 different core ids, this indicates that there are 4 actual cores.
cat /proc/cpuinfo | grep 'core id'

# cat /proc/cpuinfo | grep 'core id'
core id : 0
core id : 0
core id : 2
core id : 2
Line 882: Line 884:
core id : 3
core id : 3


; CPU Usage
So there are 4 different core ids. This indicates that there are 4 actual cores.

*Usage
top -o %CPU
top -o %CPU
htop
htop
Line 890: Line 890:
sar 1 3 ==> yum install sysstat
sar 1 3 ==> yum install sysstat
iostat ==> yum install sysstat
iostat ==> yum install sysstat

; Top Command

CPU Section

us user cpu time % CPU time spent in user space
sy system cpu time % CPU time spent in kernel space
ni user nice cpu time % CPU time spent on low priority processes
id idle cpu time % CPU time spent idle
wa io wait cpu time % CPU time spent in wait (on disk)
hi hardware irq % CPU time spent servicing/handling hardware interrupts
si software irq % CPU time spent servicing/handling software interrupts
st steal time % CPU time stolen from a virtual machine


Main Section:
%MEM directly related to RES, percentage use of total physical memory by the process.
VIRT total memory that this process has access to shared memory, mapped pages, swapped out pages, etc.
RES total physical memory used shared or private that the process has access to.
SHR total physical shared memory that the process has access to.

RES is most close to the memory used by the process in memory, excluding what’s swapped out.
This includes the SHR (shared physical memory) which mean it could have been used by some other process as well.

;Obtain the PID with a utility:
pgrep -n python
pidof chrome - return all PIDs
pidof -s chrome - return only 1 PID
ps -C chrome -o pid= - C = CMD




;Memory
;Memory
Line 911: Line 942:
;HDD
;HDD
lsblk ==> List Block Devices only in a tree structure
lsblk ==> List Block Devices only in a tree structure

du
df


== Check IP and DNS info ==
== Check IP and DNS info ==