原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://itnihao.blog.51cto.com/1741976/830374
https://www.kernel.org/doc/Documentation/sysrq.txt

# 立即重新启动计算机
echo "b" > /proc/sysrq-trigger # 立即关闭计算机
echo "o" > /proc/sysrq-trigger # 导出内存分配的信息 (可以用/var/log/message 查看)
echo "m" > /proc/sysrq-trigger # 导出当前CPU寄存器信息和标志位的信息
echo "p" > /proc/sysrq-trigger # 导出线程状态信息
echo "t" > /proc/sysrq-trigger # 故意让系统崩溃
echo "c" > /proc/sysrq-trigger # 立即重新挂载所有的文件系统
echo "s" > /proc/sysrq-trigger # 立即重新挂载所有的文件系统为只读
echo "u" > /proc/sysrq-trigger Documentation for sysrq.c Based on kernel version 2.6.. Page generated on -- : EST. Linux Magic System Request Key Hacks
Documentation for sysrq.c * What is the magic SysRq key?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
It is a 'magical' key combo you can hit which the kernel will respond to
regardless of whatever else it is doing, unless it is completely locked up. * How do I enable the magic SysRq key?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You need to say "yes" to 'Magic SysRq key (CONFIG_MAGIC_SYSRQ)' when
configuring the kernel. When running a kernel with SysRq compiled in,
/proc/sys/kernel/sysrq controls the functions allowed to be invoked via
the SysRq key. By default the file contains which means that every
possible SysRq request is allowed (in older versions SysRq was disabled
by default, and you were required to specifically enable it at run-time
but this is not the case any more). Here is the list of possible values
in /proc/sys/kernel/sysrq:
- disable sysrq completely
- enable all functions of sysrq
> - bitmask of allowed sysrq functions (see below for detailed function
description):
- enable control of console logging level
- enable control of keyboard (SAK, unraw)
- enable debugging dumps of processes etc.
- enable sync command
- enable remount read-only
- enable signalling of processes (term, kill, oom-kill)
- allow reboot/poweroff
- allow nicing of all RT tasks You can set the value in the file by the following command:
echo "number" >/proc/sys/kernel/sysrq Note that the value of /proc/sys/kernel/sysrq influences only the invocation
via a keyboard. Invocation of any operation via /proc/sysrq-trigger is always
allowed (by a user with admin privileges). * How do I use the magic SysRq key?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
On x86 - You press the key combo 'ALT-SysRq-<command key>'. Note - Some
keyboards may not have a key labeled 'SysRq'. The 'SysRq' key is
also known as the 'Print Screen' key. Also some keyboards cannot
handle so many keys being pressed at the same time, so you might
have better luck with "press Alt", "press SysRq", "release SysRq",
"press <command key>", release everything. On SPARC - You press 'ALT-STOP-<command key>', I believe. On the serial console (PC style standard serial ports only) -
You send a BREAK, then within seconds a command key. Sending
BREAK twice is interpreted as a normal BREAK. On PowerPC - Press 'ALT - Print Screen (or F13) - <command key>,
Print Screen (or F13) - <command key> may suffice. On other - If you know of the key combos for other architectures, please
let me know so I can add them to this section. On all - write a character to /proc/sysrq-trigger. e.g.: echo t > /proc/sysrq-trigger * What are the 'command' keys?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'b' - Will immediately reboot the system without syncing or unmounting
your disks. 'c' - Will perform a system crash by a NULL pointer dereference. # 立即重新启动计算机
  echo "b" > /proc/sysrq-trigger
  # 立即关闭计算机
  echo "o" > /proc/sysrq-trigger
  # 导出内存分配的信息 (可以用/var/log/message 查看)
  echo "m" > /proc/sysrq-trigger
  # 导出当前CPU寄存器信息和标志位的信息
  echo "p" > /proc/sysrq-trigger
  # 导出线程状态信息
  echo "t" > /proc/sysrq-trigger
  # 故意让系统崩溃
  echo "c" > /proc/sysrq-trigger
  # 立即重新挂载所有的文件系统
  echo "s" > /proc/sysrq-trigger
  # 立即重新挂载所有的文件系统为只读
  echo "u" > /proc/sysrq-trigger

/proc/sysrq-trigger详解的更多相关文章

  1. Atitit.设计模式-----触发器模式 trigger  详解

    Atitit.设计模式-----触发器模式 trigger  详解 1. 触发器概念1 1.1. 触发器位置 after|before|instead of1 2. 数据库里面的触发器1 2.1. o ...

  2. ORACLE DB TRIGGER详解

    本篇主要内容如下: 8.1 触发器类型 8.1.1 DML触发器 8.1.2 替代触发器 8.1.3 系统触发器 8.2 创建触发器 8.2.1 触发器触发次序 8.2.2 创建DML触发器 8.2. ...

  3. Android中proc/meminfo的详解(原)

    今天在写到获取手机可用内存空间的总大小的时候,通过下面的方法去获取的时候,发现该方法最低支持的版本是16,这显然是不可取的. public static long getTotalSpace(Cont ...

  4. /proc/stat文件详解(翻译)

    原文地址:http://www.linuxhowtos.org/System/procstat.htm 各种关于系统内核的活动信息都可以在/proc/stat文件中找到,该文件记录了自系统第一次启动以 ...

  5. mysql之触发器trigger 详解

    为了梦想,努力奋斗! 追求卓越,成功就会在不经意间追上你 mysql之触发器trigger 触发器(trigger):监视某种情况,并触发某种操作. 触发器创建语法四要素:1.监视地点(table)  ...

  6. Linux中目录proc/net/dev详解【转】

    转自:https://blog.csdn.net/yzy1103203312/article/details/77848192 版权声明:本文为博主原创文章,未经博主允许不得转载. https://b ...

  7. linux下/proc/diskstats文件详解

    每一列的含义分别为: 第一列为 设备号 (number of issued reads. This is the total number of reads completed successfull ...

  8. Linux中目录proc/net/dev详解

    在Linux系统中,系统调用是操作系统提供给应用程序使用操作系统服务的重要接口,但同时也正是通过系统调用机制,操作系统屏蔽了用户直接访问系统内核的可能性.幸运的是Linux提供了LKM机制可以使我们在 ...

  9. /proc详解

    内容摘要:Linux系统上的/proc目录是一种文件系统,即proc文件系统. Linux系统上的/proc目录是一种文件系统,即proc文件系统.与其它常见的文件系统不同的是,/proc是一种伪文件 ...

  10. 内存proc详解

    Linux系统上的/proc目录是一种文件系统,即proc文件系统.与其它常见的文件系统不同的是,/proc是一种伪文件系统(也即虚拟文件系统),存储的是当前内核运行状态的一系列特殊文件,用户可以通过 ...

随机推荐

  1. 有关T-SQL的10个好习惯(转)

    1. 在生产环境中不要出现Select * 这一点我想大家已经是比较熟知了,这样的错误相信会犯的人不会太多.但我这里还是要说一下. 不使用Select *的原因主要不是坊间所流传的将*解析成具体的列需 ...

  2. linux 命令——文件管理 cat

    一.介绍 cat 是一个文本文件查看和连接工具.从第一个字节开始正向查看文件的内容. 主要有三大功能: 1.一次显示整个文件.$ cat   filename ~,y6;e2.从键盘创建一个文件.$ ...

  3. ARM指令集----杂项指令

    ARM指令集可以分为6类,即是跳转指令,数据处理指令,程序状态传输指令,Load.Store指令,协处理器指令和异常中断指令 跳转指令: 在ARM中有两种方式可以实现程序的跳转,一种是跳转指令,另一种 ...

  4. gcc编译器基本命令

    1 unix操作系统 ubuntu 12版本Unix内核0.5天 常用命令2 c语言:标准c 十天主要练习动手能力 小案例水平高的 自己去写案例水平低的 理解并跟着写3 c++:5天高级语言的特点:面 ...

  5. [LeetCod] Single Number

    Given an array of integers, every element appears twice except for one. Find that single one. Note:Y ...

  6. Python 学习笔记(三)Function

    python引用变量的顺序: 当前作用域局部变量->外层作用域变量->当前模块中的全局变量->python内置变量 1. Scope: • If a variable is assi ...

  7. Directory.GetCurrentDirectory

    1.一个应用程序中,Directory.GetCurrentDirectory获得的当前工作目录是C:\Windows\System32,这是为什么呢?是如何设置的? 2.在WinXP下:System ...

  8. Failed to allocate the network(s), not rescheduling

    Failed to allocate the network(s), not rescheduling 在计算节点的/etc/nova/nova.conf中添加下面两句 #Fail instance ...

  9. centos5 vim升级到7.4

    vim在centos中的版本为7.0,导致很多插件都无法使用,所以想到升级一下. wget ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2 tar jvz ...

  10. HDU 4902 Nice boat (线段树)

    Nice boat 题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4902 Description There is an old country a ...