#vim编辑器的使用
##一般模式
复制:yl(字母) yw(单词) yy(行) y3y(三行)
删除:dl dw dd d3d 剪切:cl cw cc c3c (注意:剪切后进入插入模式,粘贴时要推出插入模式) 粘贴: p 撤销: u 取消撤销: ctrl+r到达文件第一行:gg
到达文件最后一行:G分屏:
左右分屏:ctrl+w v 上下分屏:ctrl+w s 删除分屏:ctrl+w c 切换分屏:ctrl+w (上下左右键)##一般模式进入插入模式
i 在光标所在位置插入I 在光标所在行行首插入 a 在光标所在位置的后面插入A 在光标所在行行未插入 o 在光标所在行的下一行建立新行插入O 在光标所在行的上一行建立新行插入s 删除光标所在的字母然后进行插入S 删除光标所在的行删除然后进行擦插入##命令模式
set nu 设置行号set nonu 取消行号set cursorline 设置行线标示set mouse=a 添加鼠标选择 注意:以上设置均为临时设置,永久生效需要修改vim配置文件/etc/vimrc 关键字搜索 /关键字 n 向上搜索关键字 N 向下搜索关键字##批量修改字符 :%s/westos/root 全部文章中行内第一个westos替换为root:%s/westos/root/g 全部文章中行内全部的westos替换为root
:16,18s/westos/root/g 文章中16到18行全部的westos替换为root
##批量添加 ctrl + v 选中需要操作的字符,按大写i,进入插入模式,写入要插入的内容,最后按esc退出插入模式即可。##批量删除 ctrl + v 选中需要操作的字符,按小写x或者Delete键即可删除选中的内容。 退出 :x 保存退出 :x 强制保存退出 :wq 保存退出 :wq! 强制保存退出 :q 退出 :q! 强制退出vim 帮助查找 : vimtutor, vimtutor -g zh_cn(中文版)##gedit编辑器,类似wps的用法ctrl +n 新建 ctrl+o 打开ctrl +s 保存 ctrl+xctrl +v ctrl+cgedit的帮助文档:yelp help:geditlinux中用户与用户组的管理:linux系统下几乎一切皆文件;linux系统中缺省值shell为bash##用户的管理用户文件 : /etc/passwd suer:passwd:uid:gid:用户说明:用户家目录:shell类型 命令: useradd (-u,-g,-d,) useradd -u //user ID of the new account useradd -g //name or ID of the primary group of the new accountusermod -c //new value of the GECOS field
usermod -d //new home directory for the user account usermod -s //new login shell for the user account usermod -G //new list of supplementary GROUPS usermod -aG //append the user to the supplemental GROUPS mentioned by the -G option without removing him/her from other groups(添加多个组)id
id -u //print only the effective user ID id -g //print only the effective group ID(实际组) id -G //print all group IDs(所有组) id -un //print a name instead of a number id -gn //print a name instead of a number id -Gn //print a name instead of a number用户组
groupadd
groupdel