logo

utils-std

Collection of commonly available Unix tools git clone https://anongit.hacktivis.me/git/utils-std.git/

mktemp.1 (1293B)


  1. .\" utils-std: Collection of commonly available Unix tools
  2. .\" Copyright 2017 Haelwenn (lanodan) Monnier <contact+utils@hacktivis.me>
  3. .\" SPDX-License-Identifier: MPL-2.0
  4. .Dd 2024-09-20
  5. .Dt MKTEMP 1
  6. .Os
  7. .Sh NAME
  8. .Nm mktemp
  9. .Nd make a new randomly-named file or directory
  10. .Sh SYNOPSIS
  11. .Nm
  12. .Op Fl dqtu
  13. .Op Fl p Ar tempdir
  14. .Op Ar template
  15. .Sh DESCRIPTION
  16. .Nm
  17. creates a new randomly-named file or directory,
  18. and prints its name.
  19. .Pp
  20. .Ar template
  21. must contain at least 6 consecutive
  22. .Ql X
  23. as last path component.
  24. If
  25. .Ar template
  26. is not specified,
  27. .Ql tmp.XXXXXXXXXX
  28. is used instead.
  29. .br
  30. Files are created with u+rw permissions, directories with u+rwx.
  31. .Sh OPTIONS
  32. .Bl -tag -width _d
  33. .It Fl d
  34. Create a directory, not a file.
  35. .It Fl q
  36. Quiet messages about file/directory creation failure.
  37. .It Fl p Ar tempdir
  38. Specify
  39. .Ar tempdir
  40. as an existing directory to create into.
  41. Overrides
  42. .Ev TMPDIR .
  43. .It Fl t
  44. Use
  45. .Ev TMPDIR
  46. or if unset,
  47. .Pa /tmp ,
  48. as an existing directory to create into.
  49. .It Fl u
  50. Unsafe mode, generate filename and print it out without creating it.
  51. .Pp
  52. Only present for compatibility with existing scripts, do not use.
  53. .El
  54. .Sh EXIT STATUS
  55. .Ex -std
  56. .Sh HISTORY
  57. An
  58. .Nm
  59. utility first appeared in
  60. .Nx 1.5
  61. and
  62. .Ox 2.1
  63. .Sh AUTHORS
  64. .An Haelwenn (lanodan) Monnier Aq Mt contact+utils@hacktivis.me