Using 5 Commands for Checking Memory Usage in Linux as a starting point, here is a summary of commands:
- top - use '<' and '>' to select different columns to sort
- free - to report in MB and to sum the columns: free -mt
- vmstat - 'vmstat -s' to provide labelled statistics, 'vmstat 2 5' - run five times at 2 second intervals, 'vmstat -d' for disk statistics
- dmidecode - 'dmidecode -t' to find types, 'dmidecode -t memory' shows memory modules, 'dmidecode -t memory|grep -i size' shows slots and how they are filled
- cat /proc/meminfo - 'egrep --color 'Mem|Cache|Swap' /proc/meminfo' to select and colorize entries
The reason to use these commands is my monitoring system says shared memory usage is increasing. The following command should show something, but doesn't:
# ipcs -m ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status # cat /proc/sysvipc/shm key shmid perms size cpid lpid nattch uid gid cuid cgid atime dtime ctime rss swap # ipcs -a ------ Message Queues -------- key msqid owner perms used-bytes messages ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status ------ Semaphore Arrays -------- key semid owner perms nsems # ipcs -lm ------ Shared Memory Limits -------- max number of segments = 4096 max seg size (kbytes) = 18014398509465599 max total shared memory (kbytes) = 18014398442373116 min seg size (bytes) = 1
Maybe it doesn't matter. From top:
The amount of shared memory used by a task. It simply reflects memory that could be potentially shared with other processes.