Is there a way to know the size of L1, L2, L3 cache and RAM in Ubuntu?
Is there a way to know the size of the L1, L2, L3 caches and RAM in Ubuntu?
Is there a terminal command or files I could look into?
Solution 1:
CPU information
Use the lscpu command:
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 15
Model: 6
Stepping: 5
CPU MHz: 2400.000
BogoMIPS: 6000.33
L1d cache: 16K
L2 cache: 2048K
NUMA node0 CPU(s): 0,1
Listed information is per CPU-core.
Memory information
There is the free command (-h gives results in human readable form, i.e. GiB rather then bytes):
$ free -h
total used free shared buffers cached
Mem: 2.0G 390M 1.6G 10M 15M 160M
-/+ buffers/cache: 215M 1.7G
Swap: 2.0G 0B 2.0G
Solution 2:
This will give you your cache information. Socket Designation will tell you which cache is being referred to in the section.
sudo dmidecode -t cache
For RAM there are a couple things to look at but meminfo should do it. I used grep here to only show total/free but you could use less or cat to see the whole thing. It shows a lot more information on memory size and usage than just size.
grep Mem /proc/meminfo
Solution 3:
Based on jkabrams answer with following command and filtering "cache" from it, each cache item you have be shown.
lscpu | grep cache
and RAM:
free -h
For more information about RAM, processes and so on you can use htop on your distro. Install it like this on ubuntu.
sudo apt-get install htop