vi

来源:互联网 发布:好想你 网络歌手 编辑:程序博客网 时间:2024/05/13 22:19
i  insert
cw  change word
:q!  unsave to quit
:wq  save and quit
:wq is equivalent to ZZ
:w! file to overwrite the existing file
:w  newfile to save the editedversion in a new file
:set nu 显示行数
: 1 到第一行去

ls -al -a:显示所有当前目录下的文件夹和文件(包括隐藏的) -l:显示文件夹和文件的详细信息

h Left, one space
j Down, one line
k Up, one line
l Right, one space

u and U will undo any changes to a line

d$  当前位置删除到行尾
d0  当前位置到行开头


------------------------------------------------------------------
H Move to home—the top line on screen.
M Move to middle line on screen.
L Move to last line on screen.
------------------------------------------------------------------
To end of line $
To beginning of line 0
: 1 go to first line
shift+g (G) go to end line
nG Go to given line n



A Append text to end of current line. 本行末尾append
I Insert text at beginning of line.   本行开头insert

o (lowercase letter “o”) Open blank line below cursor for text. 在当前行下面新建空白的一行
O (uppercase letter “o”) Open blank line above cursor for text. 在当前行上面新建空白的一行

s Delete character at cursor and substitute text.  删除当前字符,并可替换
S Delete line and substitute text. 删除当前行,并可替换
R Overstrike existing characters with new characters.
r 替换单个字符

J Join current and next line

. Repeat last action
~ Toggle case  大小写切换

2yy  复制2行  p粘贴
2dd  删除2行

------------------------------------------------------------------


Text object Change Delete Copy
One word cw dw yw
Two words, not counting punctuation 2cW or c2W 2dW or d2W 2yW or y2W
Three words back 3cb or c3b 3db or d3b 3yb or y3b
One line cc dd yy or Y
To end of line c$ or C d$ or D y$
To beginning of line c0 d0 y0
Single character r x or X yl or yh
Five characters 5s 5x 5yl

------------------------------------------------------------------

lsof -i :port,使用lsof -i :port就能看见所指定端口运行的程序,同时还有当前连接
whereis mysql



0 0
原创粉丝点击