100 Useful Command-Line Utilities

by Oliver; 2014

89. mktemp

mktemp will make a temporary directory with a unique name in your designated temporary directory. Recall that, usually, this is the directory:
/tmp
However, you can set it to be anything you like using the variable TMPDIR. Let's see mktemp in action:
$ echo $TMPDIR
/path/tempdir
$ mktemp
/path/tempdir/tmp.LaOYagQwq3
$ mktemp
/path/tempdir/tmp.h5FapGH4LS
mktemp spits out the name of the directory it creates.

<PREV   NEXT>