寻觅生命中的那一片浅草......

每日存档 十月 13th, 2009

vi快捷键

h 左
j 下
k 上
l 右
w 词首
e 词末
$ 行末
^ 行首
) 将光标移到下一句句首
( 将光标移到上一句句首
} 将光标移到下一段开始处
{ 将光标移到下一段开始处
M 光标移至屏幕中间行
z. 将光标所在行移至屏幕中部
[[ 条到文件头(gg)
]] 跳到文件尾(G)
:n 跳到第n行(nG)
ctrl+g 显示光标所在信息
Ctrl+u 向上滚动半屏
Ctrl+d 向下滚动半屏
Ctrl+f 向前翻一页
Ctrl+b 向后翻一页

x 删除字符
i 光标前插入
a 光标后插入
A 行末插入
R 替换内容
r 替换所选字符
d 删除
c 修改
dd 删除整行
2dd 删除2整行
u 撤消
U 撤消整行
ctrl+r 重做
p 粘贴最后删除的内容
yw 把光标所在单词移到缓冲区
yy 把当前行整行移到缓冲区
~ 改变光标所在字符大小写
. 重复上一个操作
<< 把当前行左移
>> 把当前行右移
:x 保存退出
:q 退出
:q! 不保存退出

/ 查找内容
? 向上查找内容
n 下一匹配
N 上一匹配
% 匹配下一半“大中小”括号
:%s/a/b/g 替换文件中a为b
:! 执行外部命令,回车返回

:set ic 忽略大小写
:set hls 匹配高亮
:set is 即时匹配输入
:set nu 显示行号
:x 加密文件
:ab c d 以d替代c

shell快捷键

bash
ctrl – a 光标移到行首
ctrl – e 光标移到行尾
ctrl – l  刷新屏幕
ctrl – u 从光标处删除到行首
ctrl – k 从光标处删除到行尾
ctrl – b 光标往后移动一个字符
ctrl – f  光标往前移动一个字符
ctrl – y 恢复被删除的收入
ctrl – p 显示之前执行的命令
ctrl – n 显示之后执行的命令
ctrl – j  执行输入的命令
ctrl – x 光标移动到行首或行尾
ctrl – c 中断程序执行
ctrl – h 删除前一个字符
ctrl – d 删除后一个字符  — 当光标处无输入时,  退出shell
ctrl – s 关闭ssh流缓冲区
ctrl – q 重启ssh流缓冲区
ctrl – r  搜索之前输入过的命令
ctrl – z 是进程暂停

转载自:http://blog.csdn.net/gggxin/archive/2009/07/27/4383481.aspx

Bash shell becomes inactive on Ctrl+S

The Ctrl+S shortcut key sequence activates XOFF which is used to pause the sending of data etc (read more here at Wikipedia about software flow control). In the Bash shell this buffers all your commands and won’t run them until you send XON which is done with Ctrl+Q.

I only learnt about this a few days ago when I accidentally pressed Ctrl+S while doing something on one of my webservers – I was meaning to press Ctrl+D to logout which is the only reason I knew which keystroke I had hit instead. It had baffled me years ago why my Bash shell suddenly became unresponsive when I’d hit what appeared to be some random keystroke combination. When it happened to me a few days ago I decided to work out why it does this and what the solution is. I remember in the past having to kill my CLI session because I didn’t know what else to do.

So in summary, it’s Ctrl+S which suspends the output and you need to hit Ctrl+Q to resume output again

统计几个目录的总大小

for i in ‘awstats www phpmyadmin webconsole’
do
for DX in `du -s $i | awk ‘{print $1}’`
do
let “DD=${DD}+${DX}”
done
let “DDD=${DD}/1024/1024”
echo ${DDD}G
done

2009年十月
« 9月   11月 »
 1234
567891011
12131415161718
19202122232425
262728293031