The free command is used to view how much memory (RAM) is available. The free command without any options will display the available memory in bytes.
~]# free
total used free shared buff/cache available
Mem: 10054428 5930312 297116 217544 3827000 3592572
Swap: 8388604 45056 8343548
Typically, the -h or --human option is used to view the available memory rounded:
~]# free --human
total used free shared buff/cache available
Mem: 9.6G 5.7G 289M 212M 3.7G 3.4G
Swap: 8.0G 44M 8.0G
The --total flag can be used to print the total memory (mem + swap).
~]$ free --human --total
total used free shared buff/cache available
Mem: 15G 5.7G 3.3G 107M 6.5G 9.4G
Swap: 8.0G 0B 8.0G
Total: 23G 5.7G 11G
The following options can be used to round the values.
~]$ free --giga
total used free shared buff/cache available
Mem: 9 5 0 0 3 3
Swap: 7 0 7
The -s or --seconds option can be used to rediplay the output every x seconds. Optionally, the --count option can be used to limit the number of times the output will be redisplayed, such as 10 times in this example.
free --seconds 1 --count 10
If swap memory free is low, refer to Linux Fundamentals - Analyzing swap memory.