1. The base operating system management commands
2 operating system shortcuts
3. Edit the operating system command vi
4. To check for system commands help manual
directory structure 5. system
Some commands and file directories have a relationship of
-
Information system data backup copy ==> cp copy command
syntax: cp parameters of the source files (files to be backed up) the target file (file after the backup)备份文件信息 [root@zhanglei /oldboy]# cp /oldboy/abc /oldboy/abc.txt
Added: overwrite the file problem
with normal replication will be prompted to overwrite the file:
[root @ zhanglei / Oldboy] # cp / Oldboy / abc /oldboy/abc.txt
cp: Overwrite '/oldboy/abc.txt' the y-?
[Root @ zhanglei / Oldboy] # CAT /oldboy/abc.txt
LEI
how to mandatory coverage:
method one: \ cp oldboy01.txt / opt / --- ignore the message covering
method two: / usr / bin / cp oldboy01.txt / opt / - - ignore prompt coverage
备份目录信息
cp -r oldboy
2.系统数据信息移动操作(剪切 move)==> mv
语法格式: mv 参数 源文件(需要移动文件)
移动文件信息:
移动目录信息:
[root@zhanglei ~]# mv /oldboy/ /tmp/
[root@zhanglei ~]# ls /tmp/
oldboy
重命名操作
[root@zhanglei ~]# mv /tmp/oldboy/ /tmp/lei
[root@zhanglei ~]# ls /tmp/
lei
3. System Data Delete remove = = rm command
to delete the file information
[root@zhanglei ~]# rm -f oldzhang/lei.txt
[root@zhanglei ~]# ls oldzhang/lei.txt
删除目录信息
rm -r /oldboy/
-f 强制删除目录数据信息 (不要有确认提示)
-r 递归删除目录下面的信息
删根操作:
rm -rf --no-preserve-root /
rm -rf /*
4.常用的系统快捷方式:
ctrl + a - - - cursor move quickly to the beginning of the line
ctrl + e - - - cursor quickly move to the end of the line
ctrl + ← - - - cursor according word character channeling quickly move around
ctrl + w - - - Delete (Shear cut) a continuous string of information (not separated by spaces)
Ctrl + Y - - - cut and paste information
ctrl + u - - - delete (shear) string information of all left of the cursor position
ctrl + k - - - deleted All right string information (cutting) position of the cursor
5.vi命令使用方式和使用技巧
vi command three modes:
1) Command Mode: first to open the file for editing mode
2) Edit mode: can directly modify the file information
3) line mode: editing instruction information input vi, perform different functions
Command Mode → Edit Mode " i "
edit mode - ESC - command mode
command mode -: - line mode
line mode - ESC - command mode
Vi命令使用技巧:
1)快速移动光标技巧
G / shift + g - - - - cursor quickly switch to the last line
GG - - - - cursor quickly switch to a file of line
10gg - - - - cursor quickly to a specific line
$ - - - - cursor quickly switch to end of the line
0 / ^ - - - - quickly switch the cursor to the beginning
2)快速移动光标并进入到编辑状态
o - - - - 将光标在当前行下边新起一行并进行修改
O - - - - 将光标在当前行上边新起一行并进行修改
i - - - - 进入编辑模式
I - - - - 将光标切换行首并进入编辑模式
A - - - -将光标切换到行末并进入编辑模式
a - - - - 在光标当前位置下一个字符进入编辑模式
C - - - - 将光标所在位置右边的所有内容清空进入编辑模式
cc - - - - 将整行内容进行清空,并进入到编辑状态
3)快速编辑文件内容信息
yy --- 复制指定内容信息
nyy --- 复制多行信息
p --- 粘贴复制或者剪切的信息
3p --- 将复制或剪切的内容粘贴3次
dd --- 删除(剪切)指定一行信息
ndd --- 删除(剪切)指定多行信息
dG --- 将光标所在行之后所有内容进行删除(剪切)
r --- 替换指定光标所在位置字符信息
R --- 进入到替换模式,可以替换多个字符信息
4)底行功能指令
set nu - - - - 显示行号信息
set nonu - - - - 取消显示行号信息
:s/oldboy/oldgirl/ --- 替换光标所在位置的信息
:%s/oldboy/oldgirl/ --- 替换文件中所有指定内容
:7,12s/oldboy/oldgirl/ --- 将指定行信息做替换修改
:6,$s/oldboy/oldgirl/ --- 将指定行到最后一行指定内容进行替换
:6,$s/oldboy/oldgirl/g --- 将一行中检索到匹配的所有信息都做替换
:6,$s/oldboy/oldgirl/ --- 将一行中检索到第一个匹配的信息做替换
PS: 替换指令使用时,分割符号可以使用 /// ### @@@
/搜索的信息 --- 在文件中检索过滤指定信息
n表示检索下一个匹配的信息
N表示返回到上一个匹配的信息
/搜索的信息\c --- 在文件检索信息时忽略大小写
特殊操作技巧
u - - - undo vi编辑中撤销操作
ctrl + r - - - redo vi编辑中取消撤销操作
作业:
01.vi编辑文件信息时,如果提示以下信息表示什么意思?如何不要显示以下信息
2.vi 编辑文件原理过程?
3.总结了解系统的目录结构