You can do this by running the command inside GNU
time
. By default, time shows you thereal
(wall clock),user
(CPU-seconds used in user mode), andsys
(CPU-seconds used in kernel mode) data items. However, you can also ask it to measure other things, such as RAM and disk usage:/usr/bin/time -f "File system outputs: %O\nMaximum RSS size: %M\nCPU percentage used: %P" <command>
where
<command>
is replaced by the command you wish to run. The output will be something like:File system outputs: 18992 Maximum RSS size: 40056 CPU percentage used: 367%
where "CPU percentage used" is a percentage and shows here that 3.6 cores were used, "Maximum RSS size" is as close as it gets to "maximum memory used" and is expressed in kilobytes, and "File system outputs" is expressed in number of operations (i.e., it does not say how much data is written). The
du
anddf
commands you gave should help there.Note: you need to use
/usr/bin/time
rather than justtime
, as many shells have that as a builtin, which doesn't necessarily support the-f
option.For more information, see
man time
O mesmo vale para o Cygwin: existe um bash embutido que pode ser substituído pelo tempo GNU.