MCOOKIE(1)

๐Ÿช MCOOKIE โ€” generate magic cookies for xauth ๐Ÿ’…

okay bestie, welcome to the mcookie page from the User Commands section of the manual, and let me tell you, this one is short but it serves.


โœจ SYNOPSIS โœจ

mcookie [options]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

mcookie generates a 128-bit random hexadecimal number for use with the X authority system. That's the whole job. She's a specialist, not a generalist, and she ate.

Typical usage, and yes you're gonna type it exactly like this:

xauth add :0 . mcookie

so the "random" number it spits out? it's not raw cosmic chaos, it's literally the MD5 message digest of random information gathered from one of these sources, in this exact preference order:

  1. the getrandom(2) system call
  2. /dev/urandom
  3. /dev/random
  4. the libc pseudo-random functions

no cap, that's the order, it goes down the list and takes the first one it can vibe with. also see the --file option if you want to throw extra randomness into the mix ๐ŸŽ€


๐Ÿ’– OPTIONS ๐Ÿ’–

  • -f, --file file โ€” use this file as an additional source of randomness (for example /dev/urandom). and listen: when file is -, characters are read from standard input. cute, right? ๐Ÿซถ
  • -m, --max-size number โ€” read from file only this number of bytes. this one is meant to be used when you're reading additional randomness from a file or device, so you don't just inhale the whole thing.

the number argument may be followed by the multiplicative suffixes KiB=1024, MiB=1024*1024, and so on for GiB, TiB, PiB, EiB, ZiB and YiB โ€” and the "iB" is optional, e.g., "K" has the same meaning as "KiB". OR you can use the suffixes KB=1000, MB=1000*1000, and so on for GB, TB, PB, EB, ZB and YB. two whole suffix families, choose your fighter โญ

  • -v, --verbose โ€” inform where randomness originated, with amount of entropy read from each source. she will tell you her sources, main character transparency ๐Ÿ’…
  • -h, --help โ€” display help text and exit. classic.
  • -V, --version โ€” display version and exit. also classic.

๐ŸŒธ FILES ๐ŸŒธ

  • /dev/urandom
  • /dev/random

two little icons, both listed, both real ๐Ÿงš


๐Ÿ’€ BUGS ๐Ÿ’€

It is assumed that none of the randomness sources will block.

that's it. that's the bug note. it's assuming nobody blocks. if something blocks, that's not this program's problem, apparently. lowkey terrifying but okay ๐Ÿ™ˆ


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

md5sum(1), X(7), xauth(1), rand(3)

go read those too, iykyk ๐Ÿ“š


๐Ÿ˜ญ REPORTING BUGS ๐Ÿ˜ญ

For bug reports, use the issue tracker <https://github.com/util-linux/util-linux/issues>.

please actually report them properly and not just vaguepost, bestie ๐Ÿ’œ


๐Ÿ‘‘ AVAILABILITY ๐Ÿ‘‘

The mcookie command is part of the util-linux package which can be downloaded from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils/util-linux/>.


and that's the whole page!! ๐ŸŒˆ this was util-linux version 2.42.4, dated 2026-09-21, signing off with a little ๐ŸŽ€ and a reminder that you are also generating magic cookies for xauth, in your own way. periodt. ๐Ÿ’–

๐Ÿ“ฆ where this page comes from
  • arch rolling: util-linux 2.42.4-1 ยท BSD-2-Clause AND BSD-3-Clause AND BSD-4-Clause-UC AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND ISC AND LGPL-2.1-or-later AND LicenseRef-PublicDomain
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms