vi编译器
1.保存退出
:wq
esc ZZ
2 插入命令 :vi模式变化到输入模式
A I O
a i o
3 光标移动命令:仅仅移动光标,不会改变模式
^:移动到行首 第一个非空字符
0:移动到行首第一个字符
$:移动到行位
nG :n :n行
n| :n 列
:set nu 设置行号
:set nonu取消行号
gg 到第一行
G 最后一行
H M L 分别到屏幕的顶端,,中间,和底端
删除命令
x 删除一个
nx删除n个
D 从坐标所在处删到行位
dd 删除坐标所在行
ndd 删除n行
:n1,n2d 删除从n1到n2
dG 从坐标所在行到文件尾
替换命令
R 不停替换
r 替换光标所在位置
u 撤销
. 重复
复制粘贴剪切命令
yy nyy 复制一行或n行
dd ndd 剪切一行或n行
p P 分别在光标所在行的下方和上方粘贴
搜索全文替换
/string 搜素字符串
n 下一个
:%s/old/new/g 全文替换
:n1,n2s/old/new/g 在指定行范围内替换
其他命令
:r !命令 命令导入
if判断
vi if.sh
按A,a,i,I,o,O进入输入命令
然后进行修改
#!/bin/bash
if [ -e $1 ]
then if [ -f $1 ]
then echo "this is an ordinary file."
elif [ -d $1 ]
then echo "this is a ordinary file."
fi
else echo "file not exist"
fi
一个if跟一个fi,记得[]里面有两个空格
之后修改权限
chmod 755 if.sh
后可以进行判断是否是一个文件
./if.sh test1
./if.sh test2
vi main.c
gcc main.c
gcc main.c -o op
./op
#include <stdio.h>
int mian()
{
printf("herllo world");
}
GUI页面
gedit
来源:https://blog.csdn.net/he1234555/article/details/101357945