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:
- the
getrandom(2)system call /dev/urandom/dev/random- 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,--filefile โ 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-sizenumber โ 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