How to create unique temporary files

Unix provides a couple of useful commands to create temporary file names or directories that can be used in your applications or shell scripts.

In Linux we have mktemp and tempfile. The simplest usage is as follows:

mktemp
/tmp/tmp.avSbCw

or…

tempfile
/tmp/file8W2jIZ

For more information take a look at man pages for both commands.

Leave a Reply

You must be logged in to post a comment.