有没有办法测量shell命令使用了多少内存?

Tom*_*ith 4 linux bash shell terminal command-line

有没有办法测量执行的终端命令/操作使用了多少内存,例如time用于测量执行时间的内置命令。我想比较具有不同参数的命令。

Tom*_*ith 5

我一直在寻找像这样。

这是我使用它的方式:

$/usr/bin/time -f "%E %M" *<command>*
Run Code Online (Sandbox Code Playgroud)

这给了我:
time (%E) - 经过的实时时间(以 [小时:] 分钟:秒为单位);
内存 (%M) - 进程在其生命周期内的最大驻留集大小,以 kB 为单位。