RedHat7 修改默认启动级别
1.删除默认的: rm /etc/systemd/system/default.target
2.启动运行级别3:ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
3.启动运行级别5:ln -sf /lib/systemd/system/graphical.target/etc/systemd/system/default.target
常见systemctl操作
查看是否开机启动:systemctl list-unit-files | grep disabled/enabled
设置一个服务开机启动或关闭: systemctl disable/enable service查看服务状态 systemctl status service
VIM:
Ctrl+f : 向下移动一页;
Ctrl+b:向上移动一页.
0:回到一行的最前端(相当于home);
$:回到一样的最后面(相当于end)
gg:移到整个文本的第一行
G:移到整个文本的最后一行.
n+enter:从当前光标向下移动n行
nG:跳到第n行
n[space]:跳到当前光标后的第n个字符处
查找与替换
:n1,n2s/word1/word2/g
表示从n1行到n2行,将word1替换为word2
:1,$s/word1/word2/g 表示从第一行到最后一行,将word1替换为word2
:1,$s/word1/word2/gc 将word1替换为word2,并提示是否需要替换
删除
x:向后删除一个一个字符(delete)
X:向前删除一个字符(backspace)
u:撤销
ctrl + r:将撤销的恢复回来.
r:替换当前字符
R:会一直取代光标所在的文字,直到按下esc为止.
:w 将编辑的数据保存到硬盘档案中
:w [filename] 代表另存为
:n1,n2w[filename] 将n1到n2行另存为一个新文件.
:r[filename] 将filename这个文件添加到光标的后面.
编辑块区:
ctrl + v : 可以选中某一个块
y:将选中的块复制
d:将选中的块删除掉
多文件编辑:
vi file1 file2 ...
:n 编辑下一个文件
:N 编辑上一个文件
可以在file1中复制内容粘贴到file2中
多个窗口:
:sp [filename] 若没有filename,则打开自身...
ctrl + w + j :上一个窗口
ctrl + w + k: 下一个窗口
crontab -e