Tag Archive for 'ram'

Find out what is using your swap, by Erik Ljungstrom

Ever wondered what it is that’s using that swap on your machine? Erik has a great post about it and a script that will help answer that question.

Here is his script:
#!/bin/bash
# Get current swap usage for all running processes
# Erik Ljungstrom 27/05/2011
SUM=0
OVERALL=0
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do
PID=`echo $DIR | cut -d / -f 3`
PROGNAME=`ps -p $PID -o comm --no-headers`
for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'`
do
let SUM=$SUM+$SWAP
done
echo "PID=$PID - Swap used: $SUM - ($PROGNAME )"
let OVERALL=$OVERALL+$SUM
SUM=0
 
done
echo "Overall swap used: $OVERALL"

Discover RAM info without opening your case

Who says you can’t find anything useful on Digg? Not me that’s for sure. I just discovered an ever so handy Linux command to find out what kind of RAM you have.

It’s easy enough, just run
sudo dmidecode --type memory

And you’ll get something back, like:
# dmidecode 2.10
SMBIOS 2.5 present.

Handle 0x1100, DMI type 17, 27 bytes
Memory Device
Array Handle: 0x1000
Error Information Handle: Not Provided
Total Width: 64 bits
Data Width: 64 bits
Size: 2048 MB
Form Factor: DIMM
Set: None
Locator: DIMM_1
Bank Locator: Not Specified
Type: DDR2
Type Detail: Synchronous
Speed: 800 MHz
Manufacturer: AD00000000000000
Serial Number: 0000100B
Asset Tag: 010807
Part Number: HYMP125U64CP8-S6

Pretty cool, huh?

It doesn’t stop there, however.

Valid type keywords are:
bios
system
baseboard
chassis
processor
memory
cache
connector
slot

Go crazy.