I’ve used time before:

1
2
3
4
5
time [some command here]

real    0m0.001s
user    0m0.001s
sys     0m0.000s

But I never realized there is a much more verbose version than the command I have been running.

Turns out the time I used is a Bash shell key word:

1
2
type time
time is a shell keyword

I can do this instead:

1
/usr/bin/time -v [some command here]

And this is the GNU time command, which in its verbose (-v) form, generates the following output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
User time (seconds): 0.00
System time (seconds): 0.00
Percent of CPU this job got: 100%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:00.00
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 2976
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 147
Voluntary context switches: 1
Involuntary context switches: 0
Swaps: 0
File system inputs: 0
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0

I also leared about using dd together with /dev/urandom as a way to generate a (potentially very large) file containing random data, as I wanted to run a process - and time it - against such a file:

1
2
3
4
dd if=/dev/urandom of=sample.txt bs=4M count=10
10+0 records in
10+0 records out
41943040 bytes (42 MB) copied, 0.320172 s, 131 MB/s

If I want only human readable random data, I can use this:

1
base64 /dev/urandom | head -c 40000000 > sample.txt

This gives me a file containing 76 characters per line.

And if I want a file with no line feeds, I can add -w0:

1
base64 -w0 /dev/urandom | head -c 40000000 > sample.txt