Chinaunix首页 | 论坛 | 博客
  • 博客访问: 203478
  • 博文数量: 33
  • 博客积分: 1241
  • 博客等级: 中尉
  • 技术积分: 330
  • 用 户 组: 普通用户
  • 注册时间: 2007-01-20 16:34
个人简介

..

文章分类

全部博文(33)

文章存档

2012年(1)

2011年(8)

2010年(8)

2009年(4)

2007年(12)

我的朋友

分类: LINUX

2011-04-22 14:58:32

$ stty -a
speed 38400 baud; rows 24; columns 80; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ;
eol2 = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; flush = ^O; min = 1; time = 0;
-parenb -parodd cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl ixon -ixoff
-iuclc -ixany -imaxbel
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt
echoctl echoke

如果要屏蔽eof = ^D之类的,使用”stty eof 其他键” 就可以完成。
而另一个方法 就是使用trap ” 2之类的命令。
这里的2就是kill -l所列出的清单中,2所代表的信号值–(2) SIGINT)。
这里解释下,trap ” 2,它的意思,如果捕捉到SIGINT,那么采取”动作,及不作处理。
(如果要重置某个信号的处理条件到其默认值,只需简单的将command设置为-。如果要忽略某个信号,就把command设置为空字符串‘’。一个不带参数的trap命令将列出当前设置的信号及其行动的清单。)


1) SIGHUP     本信号在用户终端连接(正常或非正常)结束时发出, 通常是在终端的控制进程结束时, 通知同一session内的各个作业, 这时它们与控制终端不再关联
2) SIGINT     程序终止(interrupt)信号, 在用户键入INTR字符(通常是Ctrl-C)时发出   
3) SIGQUIT    和SIGINT类似, 但由QUIT字符(通常是Ctrl-\)来控制. 进程在因收到SIGQUIT退出时会产生core文件, 在这个意义上类似于一个程序错误信号
4) SIGILL     执行了非法指令. 通常是因为可执行文件本身出现错误, 或者试图执行数据段. 堆栈溢出时也有可能产生这个信号.   
5) SIGTRAP    由断点指令或其它trap指令产生. 由debugger使用
6) SIGABRT    程序自己发现错误并调用abort时产生
7) SIGIOT     在PDP-11上由iot指令产生, 在其它机器上和SIGABRT一样
8) SIGBUS     非法地址, 包括内存地址对齐(alignment)出错. eg: 访问一个四个字长的整数, 但其地址不是4的倍数
9) SIGFPE     在发生致命的算术运算错误时发出. 不仅包括浮点运算错误, 还包括溢出及除数为0等其它所有的算术的错误
10) SIGKILL   用来立即结束程序的运行. 本信号不能被阻塞, 处理和忽略
11) SIGUSR1   留给用户使用
12) SIGSEGV   试图访问未分配给自己的内存, 或试图往没有写权限的内存地址写数据
13) SIGUSR2   留给用户使用
14) SIGPIPE   Broken pipe
15) SIGALRM   时钟定时信号, 计算的是实际的时间或时钟时间. alarm函数使用该信号
16) SIGTERM   程序结束(terminate)信号, 与SIGKILL不同的是该信号可以被阻塞和处理. 通常用来要求程序自己正常退出. shell命令kill缺省产生这个信号
17) SIGCHLD   子进程结束时, 父进程会收到这个信号
18) SIGCONT   让一个停止(stopped)的进程继续执行. 本信号不能被阻塞. 可以用一个handler来让程序在由stopped状态变为继续执行时完成特定的工作. 例如, 重新显示提示符
19) SIGSTOP   停止(stopped)进程的执行. 注意它和terminate以及interrupt的区别: 该进程还未结束, 只是暂停执行. 本信号不能被阻塞, 处理或忽略
20) SIGTSTP   停止进程的运行, 但该信号可以被处理和忽略. 用户键入SUSP字符时(通常是Ctrl-Z)发出这个信号
21) SIGTTIN   当后台作业要从用户终端读数据时, 该作业中的所有进程会收到SIGTTIN信号. 缺省时这些进程会停止执行
22) SIGTTOU   类似于SIGTTIN, 但在写终端(或修改终端模式)时收到
23) SIGURG    有紧急数据或out-of-band数据到达socket时产生
24) SIGXCPU   超过CPU时间资源限制. 这个限制可以由getrlimit/setrlimit来读取/改变
25) SIGXFSZ    超过文件大小资源限制
26) SIGVTALRM  虚拟时钟信号. 类似于SIGALRM, 但是计算的是该进程占用的CPU时间
27) SIGPROF    类似于SIGALRM/SIGVTALRM, 但包括该进程用的CPU时间以及系统调用的时间
28) SIGWINCH   窗口大小改变时发出
29) SIGIO      文件描述符准备就绪, 可以开始进行输入/输出操作


----------
bash hotkey

The default shell on most Linux operating systems is called Bash. There are a couple of important hotkeys that you should get familiar with if you plan to spend a lot of time at the command line. These shortcuts will save you a ton of time if you learn them.

Ctrl + A     Go to the beginning of the line you are currently typing on
Ctrl + E     Go to the end of the line you are currently typing on
Ctrl + L     Clears the Screen, similar to the clear command
Ctrl + U     Clears the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + H     Same as backspace
Ctrl + R     Let’s you search through previously used commands
Ctrl + C     Kill whatever you are running
Ctrl + D     Exit the current shell
Ctrl + Z     Puts whatever you are running into a suspended background process. fg restores it.
Ctrl + W     Delete the word before the cursor
Ctrl + K     Clear the line after the cursor
Ctrl + T     Swap the last two characters before the cursor
Esc + T     Swap the last two words before the cursor
Alt + F     Move cursor forward one word on the current line
Alt + B     Move cursor backward one word on the current line
Tab         Auto-complete files and folder names

































阅读(1470) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~