According to the man page, `--tmpfile` is the long option for `-p` However, I get different results when using one or the other. The `-p` option results in success:
<pre><code> $ mktemp -p ~/Demo /home/klaatu/Demo/tmp.6TWPxScyKK $ mktemp -p ~/Demo XXX /home/klaatu/Demo/KdC </code></pre> However, `--tempdir` results in failure: <pre><code> $ mktemp --tmpdir ~/Demo mktemp: too few X's in template ‘/home/klaatu/Demo’ $ mktemp --tmpdir ~/Demo XXX mktemp: too many templates Try 'mktemp --help' for more information. $ mktemp --tmpdir='~/Demo' XXX mktemp: failed to create file via template ‘~/Demo/XXX’: No such file or directory </code></pre> Here's strace: <pre><code> $ mktemp --version mktemp (GNU coreutils) 8.32 $ cat /etc/os-release | grep PRETTY PRETTY_NAME="Red Hat Enterprise Linux 9.0 (Plow)" $ strace mktemp --tmpdir ~/Demo XXX execve("/usr/bin/mktemp", ["mktemp", "--tmpdir", "/home/klaatu/Demo", "XXX"], 0x7ffdb6f6dee8 /* 51 vars */) = 0 brk(NULL) = 0x5589aecdf000 arch_prctl(0x3001 /* ARCH_??? */, 0x7ffc6717d8b0) = -1 EINVAL (Invalid argument) access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=57851, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 57851, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2176368000 close(3) = 0 openat(AT_FDCWD, "/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 3 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\220P\4\0\0\0\0\0"..., 832) = 832 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 pread64(3, "\4\0\0\0 \0\0\0\5\0\0\0GNU\0\2\0\0\300\4\0\0\0\3\0\0\0\0\0\0\0"..., 48, 848) = 48 pread64(3, "\4\0\0\0\24\0\0\0\3\0\0\0GNU\0y\356%$ [\271\321\0350\340\225\347\356&)\252"..., 68, 896) = 68 newfstatat(3, "", {st_mode=S_IFREG|0755, st_size=2389384, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2176366000 pread64(3, "\6\0\0\0\4\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0@\0\0\0\0\0\0\0"..., 784, 64) = 784 mmap(NULL, 2136752, PROT_READ, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7f217615c000 mprotect(0x7f2176188000, 1880064, PROT_NONE) = 0 mmap(0x7f2176188000, 1531904, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED| MAP_DENYWRITE, 3, 0x2c000) = 0x7f2176188000 mmap(0x7f21762fe000, 344064, PROT_READ, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1a2000) = 0x7f21762fe000 mmap(0x7f2176353000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED| MAP_DENYWRITE, 3, 0x1f6000) = 0x7f2176353000 mmap(0x7f2176359000, 51888, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED| MAP_ANONYMOUS, -1, 0) = 0x7f2176359000 close(3) = 0 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f2176159000 arch_prctl(ARCH_SET_FS, 0x7f2176159740) = 0 set_tid_address(0x7f2176159a10) = 42371 set_robust_list(0x7f2176159a20, 24) = 0 mprotect(0x7f2176353000, 12288, PROT_READ) = 0 mprotect(0x5589adf75000, 4096, PROT_READ) = 0 mprotect(0x7f21763ab000, 8192, PROT_READ) = 0 prlimit64(0, RLIMIT_STACK, NULL, {rlim_cur=8192*1024, rlim_max=RLIM64_INFINITY}) = 0 munmap(0x7f2176368000, 57851) = 0 getrandom("\x40\x9a\x11\x9c\x8d\x3b\x6d\x8a", 8, GRND_NONBLOCK) = 8 brk(NULL) = 0x5589aecdf000 brk(0x5589aed00000) = 0x5589aed00000 openat(AT_FDCWD, "/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=223542144, ...}, AT_EMPTY_PATH) = 0 mmap(NULL, 223542144, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f2168c29000 close(3) = 0 openat(AT_FDCWD, "/usr/share/locale/locale.alias", O_RDONLY|O_CLOEXEC) = 3 newfstatat(3, "", {st_mode=S_IFREG|0644, st_size=2998, ...}, AT_EMPTY_PATH) = 0 read(3, "# Locale name alias data base.\n#"..., 4096) = 2998 read(3, "", 4096) = 0 close(3) = 0 openat(AT_FDCWD, "/usr/share/locale/en_NZ.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_NZ.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en_NZ/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en.UTF-8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT (No such file or directory) write(2, "mktemp: ", 8mktemp: ) = 8 write(2, "too many templates", 18too many templates) = 18 write(2, "\n", 1 ) = 1 write(2, "Try 'mktemp --help' for more inf"..., 42Try 'mktemp --help' for more information. ) = 42 close(1) = 0 close(2) = 0 exit_group(1) = ? +++ exited with 1 +++ </code></pre>