Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is it possible to cause a kernel panic with a single command line?

What would be the most straightforward such command for a sudoing user and what would it be for a regular user, if any?

Scenarios that suggest downloading something as a part of the command do not count.

share|improve this question
Write a buggy driver. –  Kevin Feb 26 '13 at 19:39
:(){ :|:& };: maybe? –  Carl Feb 26 '13 at 21:27
@carleeto Ok, could you explain that one to rest of us? –  hydroparadise Feb 26 '13 at 22:30
@hydroparadise It's called a "forkbomb". :() defines a function called : with the body of :|:&, meaning "run : and also run : in the background". ; ends the function definition, and : calls your new function, which endlessly spawns new versions of itself until you either hit process limits or the system grinds to a halt. It's a command that effectively freezes any system without good process limits set. Don't try this at home. –  Phoshi Feb 26 '13 at 22:37
@Kevin You mean writing a C program, compiling it, and installing it as a driver, all in a single command line? A working example would be great. –  Desmond Hume Feb 26 '13 at 23:13

3 Answers 3

up vote 23 down vote accepted


sysctl debug.kdb.panic=1

Linux (more info here):

echo c > /proc/sysrq-trigger
share|improve this answer
echo c > /proc/sysrq-trigger sure does a good job in freezing a Linux system. But personally, an ol' good black screen of death narrating about a dramatic development of the call stack would feel like a more "canonical" kernel panic. –  Desmond Hume Feb 27 '13 at 0:01
On Linux, you might have to echo 1 > /proc/sys/kernel/sysrq before you are able to echo c > /proc/sysrq-trigger. –  Christian Mar 19 '14 at 8:16
how in OpenBSD? –  mykhal Apr 24 '14 at 13:35

The kernel is meant to keep running no matter what. So any way to cause a kernel panic by user interaction (other than deliberate vandalism by all-powerful root, like Bruce Ediger jokinkly proposes, and most kernels today are built so most of those pranks won't work in the first place) is an extremely serious bug, that would get fixed fast.

share|improve this answer
Well, there is no much use of the kernel when the system has been completely frozen by a non-sudoing user who issued a command in the likeness of :(){ :|:& };:. –  Desmond Hume Feb 26 '13 at 23:27
@DesmondHume A good setup doesn't crash due to too many processes. Look in to the /etc/security/limits.conf file. –  Vreality Feb 27 '13 at 1:43

compile the following code into a module and insmod it, sure you should get a panic:

static int crash_module_init(void)

     printf("crash module starting\n");
     int *p = 0;

     printk("%d\n", *p);

     return 0;

static void crash_module_exit(void)
    printf("crash module exiting\n");

share|improve this answer
This will cause an oops, but not a panic. –  SkyDan Nov 7 '13 at 13:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.