Try the time command (not the shell builtin):
$ command time -f 'max resident:\t%M KiB' ls /
bin etc initrd.img.old lib32 media proc sbin tmp vmlinuz
boot home iso lib64 mnt root srv usr vmlinuz.old
dev initrd.img lib lost+found opt run sys var
max resident: 968 KiB