Linux 基本操作(二)
1. 在用 vim 打开的 .vimc 情况下,可以在底行模式下输入 :vs test.c 就打开了 test.c 文件了,vim 就分屏成两半了哦。
2. file a.out 可以查看可执行程序 a.out 的相关文件信息。libc.so.6 去掉 lib,去掉 .so.6 得到的是 c 库。
3. ldd a.out 又可以看到 a.out 文件的相关信息。
4. gcc test.c -o test,用 file test 来看默认是 dynamically linked。gcc test.c -o test.s -static,用 file test.s 来看默认是 statically linked。而且两者的内存大小差距也是比较大的。
5. 对于 ubuntu 系统是没有 yum 操作的,得用 sudo apt-get install -y + 软件名称。就是得用 apt-get,centos 用的是 yum。
6. make 是一个命令,makefile 是一个文件。make 等价于 make mycode,因为生成的可执行程序只会生成一份的哦。make clean 则要加上 clean,clean 不能少的哦。makefile 文件的举例子写法 :
mycode:mycode.c # 依赖关系
gcc mycode.c -o mycode # 依赖方法
.PHONY:clean
clean:
rm -f mycode
7. xshell 里面好像不能传递一个目录到 windows。对于 ubuntu 系统来说,先 sudo apt-get install -y zip,sudo apt-get install -y unzip,再 zip Process Process.zip 生成 Process 的压缩包 Process.zip,就可以 sz Process.zip 传递到 windows 指定地方了。
8. git clone https://… 就可以把 gitee 上对应的仓库下载到本地。当把要上传的东西放进仓库目录下后,git add .,git commit -m ‘commit log’(提交日志),git push。就可以在 gitee 上看到提交的代码了哦。
(如果在 gitee 上改了仓库的内容,又要用 git 三板斧上传代码到 gitee,当 git push 的时候就会又发生冲突的报错。所以先得 git pull 拉取 gitee 上的仓库同步一下,再使用三板斧上传文件。)
9. git log 查看仓库的提交版本信息。git status 查看仓库与之前又什么文件差异。git mv 重命名,git rm 删除。
10. 关于 fatal: empty ident name (for fujing@localhost.localdomain) not allowed 报错的解决方法 :一般是刚开始的时候又这个问题,解决了后面就不会弹出这个报错了。
运行 :两行代码就可以了