linux基础之vim快速入门
vi和vim快捷键
快捷键使用练习
拷贝当前行 yy,拷贝当前行向下的5行, 5yy,并粘贴(输入p)
删除当前行 dd,删除当前行下面的5行, 5dd
在文件中查找某个单词[命令行下/关键字,回车查找,输入n就是查找下一个]
设置文件的引号,取消文件的行号[命令行下 :set nu 和 :set nonu]
./mycod
0:Success
1:Operation not permitted
2:No such file or directory
3:No such process
4:Interrupted system call
5:Input/output error
6:No such device or address
7:Argument list too long
8:Exec format error
9:Bad file descriptor
10:No child processes
11:Resource temporarily unavailable
12:Cannot allocate memory
13:Permission denied
14:Bad address
15:Block device required
打印错误码
cat mycod.c
#include<stdio.h>
#include<string.h>
int main(int argc,char* argv[],char* env[])
{
//int i=0;
extern char** environ;
//for(i = 0; i<argc; i++)
//for(i = 0;env[i]; i++)
//for(int i=0;environ[i];i++)
for(int i=0;i<100;i++)
{
//printf("argv[%d] -> %s\n",i,argv[i]);
//printf("env[%d]:%s\n",i,env[i]);
//printf("%d:%s\n",i,environ[i]);
printf("%d:%s\n",i,strerror(i));
}
return 0;
}
echo $?
0
进程如何退出?
1.main函数调用return返回
2.任意地方调用exit()
3._exit()
exit:终止进程,主动刷新缓冲区
_exit: 不会刷新缓冲区
ps ajc | head -1
PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
ps ajx | head -1 && ps axj | grep mytest
PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND
2413 27283 27282 2104 pts/0 27282 R+ 1000 0:00 grep --color=auto mytest
将grep进程去除:
ps ajx | head -1 && ps axj | grep mytest | grep -v grep
PPID PID PGID SID TTY TPGID STAT UID TIME COMMAND