Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Presumably it's somehow related to memory? What would

sudo cat /dev/urandom > /dev/mem

do? Trash all RAM? All non-kernel virtual memory? None of the above?

share|improve this question
See also: dd if=/dev/urandom of=/dev/kmem bs=1 count=1 seek=$RANDOM – user3490 Sep 9 '12 at 12:14
Shouldn't memory protection stop access to the physical RAM for all processes except the one which has been assigned to that area of RAM? Or does sudo override that protection? – Matthew Lock Aug 14 '14 at 3:05
up vote 20 down vote accepted

It provides access to the system's physical memory.

Here's some more info on what /dev/mem is.

Yes -- it could cause all sorts of problems. A reboot should fix you, but bad things can happen very easily. Be careful! :-)

share|improve this answer
I'd suggest reviewing the mem man page. Rags is correct. "mem is a character device file that is an image of the main memory of the computer. It may be used, for example, to examine (and even patch) the system. Byte addresses in mem are interpreted as physical memory addresses." And... "The file kmem is the same as mem, except that the kernel virtual memory rather than physical memory is accessed." – Mr. Shickadance Feb 24 '11 at 12:26

/dev/mem provides access to the system's physical memory, not the virtual memory. The kernels virtual address space can be accessed using /dev/kmem.

It's primarily used to access IO memory addresses related to peripheral hardware, like video adapters.

share|improve this answer

sudo cat /dev/urandom > /dev/mem won't do anything, since sudo will elevate the privilege of cat but not of the redirect. You can either do sudo su and then work in the root shell, or use
sudo dd if=/dev/urandom of=/dev/mem

/dev/mem provides access to physical memory, i.e. all of the RAM in the system, however this doesn't mean that it gives you full read/write access to RAM (see CONFIG_STRICT_DEVMEM option in this document). Also note that some regions of physical memory will have other devices like video card memory, etc. mapped onto it.

Writing blindly to /dev/mem will result in an uncertain behaviour, here is a youtube video doing the same.

share|improve this answer

You must log in to answer this question.