how can I check the memory of computer in ubuntu

C++
watch -n 5 free -m$ sudo apt-get update
$ sudo apt install htop
$ htop
Source

Also in C++: