mem(4)

πŸ’– mem β€” bestie, we're going straight into the machine πŸ’–

okay so this is mem(4) from the Kernel Interfaces Manual, and it's the one where you literally vibe-check the computer's actual memory. raw. unfiltered. main character energy on the lowest level possible.


✨ NAME ✨

mem, kmem, port</p> β€” system memory, kernel memory and system ports. that's the trio. the whole squad. 🫢


🌸 DESCRIPTION 🌸

/dev/mem is a character device file that is an image of the main memory of the computer. like, the whole memory. the actual memory. no cap. πŸ”₯

it may be used, for example, to examine (and even patch) the system. yes, patch. we love a file that lets you poke the machine directly.

Byte addresses in /dev/mem are interpreted as physical memory addresses. so when you seek somewhere, you're seeking in real, actual, physical space. References to nonexistent locations cause errors to be returned β€” the kernel is not gonna pretend it knows what you're talking about, bestie. it'll just error out. πŸ’€

heads up, babes: examining and patching is likely to lead to unexpected results when read-only or write-only bits are present. it's giving chaos. stay aware.

Since Linux 2.6.26, and depending on the architecture, the CONFIG_STRICT_DEVMEM kernel configuration option limits the areas which can be accessed through this file. For example: on x86, RAM access is not allowed, but accessing memory-mapped PCI regions is. so it's a selective-access situation. an exclusive club. πŸŽ€

It is typically created by:

mknod -m 660 /dev/mem c 1 1
chown root:kmem /dev/mem

The file /dev/kmem is the same as /dev/mem, except that the kernel virtual memory rather than physical memory is accessed. same vibe, different address space. πŸ¦‹

Since Linux 2.6.26, this file is available only if the CONFIG_DEVKMEM kernel configuration option is enabled. no config option, no /dev/kmem. that's the rule.

It is typically created by:

mknod -m 640 /dev/kmem c 1 2
chown root:kmem /dev/kmem

/dev/port is similar to /dev/mem, but the I/O ports are accessed. different door, same energy. ✨

It is typically created by:

mknod -m 660 /dev/port c 1 4
chown root:kmem /dev/port

πŸŽ€ FILES πŸŽ€

  • /dev/mem
  • /dev/kmem
  • /dev/port

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the tea, bestie β€” this page came to you straight out of Linux man-pages 6.20, dated 2025-05-17, and it's mem(4) so you know where to find it again. go forth and respect the memory. periodt. πŸ’…πŸ’–πŸŒˆ

πŸ“¦ where this page comes from
  • arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
  • nixpkgs unstable: man-pages 6.20
  • πŸ“œ the page's license: GPL-2.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms