Some of the way by which you can monitor your CPU and RAM usage in Ubuntu via CLI.
Simplest way to monitor your resource utilization in Ubuntu via CLI is TOP Command. It gives you resource being utilized by each process.
Another way to simply get the memory status is free command.
The free command is the most simple and easy to use command to check memory usage on linux.
free -m option gives you memory utilization in MBs.
free -g option gives you memory utilization in GBs.