ubuntu memory command line

C++
watch -n 5 free -m
Source

Also in C++: