Saved for posterity. Possibly there is an easier way.
$# root@mt:/var/log# bash memreport
Name: bash: 10588
Name: bash: 10600
Name: bash: 20548
Name: cron: 22420
Name: getty: 5928
Name: init: 8352
Name: ntpd: 38332
Name: rsyslogd: 54144
Name: sort: 59840
Name: sshd: 49168
Name: sshd: 70452
Name: udevd: 16864
Name: udevd: 16864
Name: udevd: 16868
$# cat memreport
#!/bin/bash
for i in /proc/[123456789]*/status; do
size=$(grep VmSize $i | awk '{print $2}')
(( size > 0 )) && echo -e "$(grep Name: $i): \t$size"
done | sort -n;
Bash has a built in history function that records recent shell commands. But by default it only retains a raw list of those without attaching additional information. You can add a timestamps to each command by adding something like…
1
| echo 'export HISTTIMEFORMAT="%F-%R%t"' >> ~/.bashrc |
… and then after reloading your shell session you will see something like …
1
2
3
| :~$ history | tail -n 2
502 2009-10-15-11:26 vim .bashrc
503 2009-10-15-11:26 history | tail -n 2 |
You can see much more about what you can do with bash and the history command, including redirecting history commands in the bash and date man pages for your favourite linux distro.
Update: Another option on a debian system (possibly others) would be to use the snoopy package, as described at http://www.debian-administration.org/articles/88