
先 按一下 ESC 退出,然后 按 : 键,然后输入 wq 保存并退出的意思,再打回车,即可退出编辑状态。
使用 gcc -o C源文件
即可编译。
1 29
lzbltx
2010-10-11 超过23用户采纳过TA的回答
关注
:wq是vi的编辑命令,vi编辑命令中“:”命令最后输入回车键执行。找一个LINUX入门的书,学习一下简单的vi命令就可以编辑程序了。
0果在命令行下使用gedit, 关闭程序窗口(一般先保存文件),就自动退到命令行界面。
如果在命令行下使用vim,先按下ESC退出编辑模式,然后输入:wq 保存并退出或者q退出或者q!强制退出,从而回到命令行界面。
扩展资料:
linux常见命令:
命令
apropos whatis显示和word相关的命令。 参见线程安全
man -t man | ps2pdf - >man.pdf生成一个PDF格式羡正的帮助文件
which command显示命令的完整路径名
time command计算命令运行的时间
time cat开始计时. Ctrl-d停止。参见sw
nice info运行一个低优先级命令(这里是info)
renice 19 -p $$使脚本运行于低优先级。用于非交互任务。
目录 *** 作
cd -回到前一目录
cd回到用户目录
(cd dir &&command)进入目录dir,执行命令command然后回到当前目录
pushd .将当前目录压入栈,以后你可以使用popd回到此目录
文件搜索
alias l='ls -l --color=auto'单字符文件列表命令
ls -lrt按日期显示文件. 参见newest
ls /usr/bin | pr -T9 -W$COLUMNS在当前终端宽度上打印9列输出
find -name '*.[ch]' | xargs grep -E 'expr'在当前目录及其子目录下所有.c和.h文件中寻找'expr'. 参见findrepo
find -type f -print0 | xargs -r0 grep -F 'example'在当前目录及其子目录中的常规文件中查找字符串'example'
find -maxdepth 1 -type f | xargs grep -F 'example'在当前目录下查找字符串'example'
find -maxdepth 1 -type d | while read dirdo echo $direcho cmd2done对每一个找到的文件执行多个命令(使用橡胡while循环)
find -type f ! -perm -444寻找所有不可读的文件(对网站有用)
find -type d ! -perm -111寻找不可访问的目录(对网站有用)
locate -r 'file[^/]*\.txt'使用locate 查找所有符合*file*.txt的文件
look reference在(有序)字典中快速查找
grep --color reference /usr/share/dict/words使字典中匹配的正则表达式高亮
归档 and compression
gpg -c file文件加密
gpg file.gpg文件解密
tar -c dir/ | bzip2 >dir.tar.bz2将目录dir/压缩打包
bzip2 -dc dir.tar.bz2 | tar -x展开压缩包 (对tar.gz文件使用gzip而不是bzip2)
tar -c dir/ | gzip | gpg -c | ssh user@remote 'dd of=dir.tar.gz.gpg'目录dir/压缩打包并放到远程机器上
find dir/ -name '*.txt' | tar -c --files-from=- | bzip2 >dir_txt.tar.bz2将兄如悔目录dir/及其子目录下所有.txt文件打包
find dir/ -name '*.txt' | xargs cp -a --target-directory=dir_txt/ --parents将目录dir/及其子目录下所有.txt按照目录结构拷贝到dir_txt/
( tar -c /dir/to/copy ) | ( cd /where/to/ &&tar -x -p )拷贝目录copy/到目录/where/to/并保持文件属性
( cd /dir/to/copy &&tar -c . ) | ( cd /where/to/ &&tar -x -p )拷贝目录copy/下的所有文件到目录/where/to/并保持文件属性
( tar -c /dir/to/copy ) | ssh -C user@remote 'cd /where/to/ &&tar -x -p'拷贝目录copy/到远程目录/where/to/并保持文件属性
dd bs=1M if=/dev/sda | gzip | ssh user@remote 'dd of=sda.gz'将整个硬盘备份到远程机器上
0
输入的时候,直接输入雀燃16进制的顷改虚数歼旦比如
12 45 4F 2B
调用scanf的时候 用%x格式即可。
比如
int a
scanf("%x",&a)
第一种模灶方法数组内容自定义桥码裂 #include <stdio.h> main() { int a[10],n,i scanf("%d",&n) for(i=0i<10i++)scanf("%d",&a[i]) for(i=0i<10i++)if(n==a[i])break if(i==10)printf("no found")else printf("%d",i) system("PAUSE") } 第二种方法数组内容已定义敏闭 #include <stdio.h> main() { int a[10]={0,1,2,3,4,5,6,7,8,9},n,i scanf("%d",&n) for(i=0i<10i++)if(n==a[i])break if(i==10)printf("no found")else printf("%d",i) system("PAUSE") }欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)