100 Useful Command-Line Utilities
by Oliver; 201489. 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.h5FapGH4LSmktemp spits out the name of the directory it creates.