Cheatsheet: Difference between revisions

Content added Content deleted
Line 892: Line 892:


; Top Command
; Top Command
<pre>
top - 01:07:37 up 2:40, 1 user, load average: 0.37, 0.37, 0.39
Tasks: 286 total, 1 running, 285 sleeping, 0 stopped, 0 zombie
%Cpu(s): 4.7 us, 1.6 sy, 0.0 ni, 93.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 15935.7 total, 9403.3 free, 3045.2 used, 3487.1 buff/cache
MiB Swap: 4100.0 total, 4100.0 free, 0.0 used. 11720.3 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
6865 aman 20 0 982620 85280 53716 S 6.2 0.5 2:52.77 Xorg
10082 aman 20 0 3537624 285448 118848 S 6.2 1.7 5:45.24 gnome-shell
</pre>


CPU Section
CPU Section
Line 914: Line 925:
This includes the SHR (shared physical memory) which mean it could have been used by some other process as well.
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:
;Obtain the PID:
pgrep -n python
pgrep -n python
pidof chrome - return all PIDs
pidof chrome - return all PIDs
Line 921: Line 932:




=== Memory ===


;Info
;Memory
*Info
dmidecode -t 17
dmidecode -t 17


*Usage
;Usage
cat /proc/meminfo ==> egrep --color 'Mem|Cache|Swap' /proc/meminfo
cat /proc/meminfo ==> egrep --color 'Mem|Cache|Swap' /proc/meminfo
top -o %MEM
top -o %MEM
free -m
free -m
total used free shared buff/cache available
Mem: 15935 3046 9470 767 3418 11787
Swap: 4099 0 4099

vmstat
vmstat
vmstat -s ==> More detailed
vmstat -s ==> More detailed
htop
htop


* Per Process
;Per Process usage check
ps -o pid,user,%mem,command ax | sort -b -k3 -r
ps -o pid,user,%mem,command ax | sort -b -k3 -r
sudo pmap 917 ==> Libraries, otehr files, etc usage of memory
sudo pmap 917 ==> Libraries, other files, etc usage of memory
sudo pmap 917 | tail -n 1 ==> Total used by this process
sudo pmap 917 | tail -n 1 ==> Total used by this process




;HDD
=== HDD ===
lsblk ==> List Block Devices only in a tree structure
lsblk ==> List Block Devices only in a tree structure


du
du
df
df -h
Filesystem Type Size Used Avail Use% Mounted on
/dev/sda4 ext4 77G 51G 22G 71% /


sudo fdisk -l ==> Partition & FS Type details
parted ==> List out partitions and modify them


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