上QQ阅读APP看书,第一时间看更新
1.1.3 文件操作
1.新建文件
新建一个文件可以使用“vim”命令,但是使用“vim”命令退出打开的文件时需要保存退出,否则会视为没有创建文件。
zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ vim s3c6410.h zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls s3c6410.h
2.复制文件
复制文件命令为“cp”。如下:
zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls include s3c6410.c s3c6410.h zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ cp s3c6410.h include/ zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls include s3c6410.c s3c6410.h zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls include/ s3c6410.h
如果要复制并且重命名,如下操作:
zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls include kernel s3c6410.c s3c6410.h zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ cp s3c6410.c include/s3c6400.c zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls include/ s3c6400.c s3c6410.h
当复制目录时,使用“cp -r”命令。如下:
zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls include kernel s3c6410.c s3c6410.h zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls kernel/ zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ cp -r include/ kernel/ zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls include kernel s3c6410.c s3c6410.h zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls kernel/ include
3.移动文件
移动一个文件则使用“mv”命令,如下:
zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls include kernel s3c6410.c s3c6410.h zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ mv s3c6410.c kernel/ zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls include kernel s3c6410.h zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ ls kernel/ include s3c6410.c
编辑一个文件,建议使用“gedit”命令或者“vim”命令。
zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ gedit s3c6410.h zhuzhaoqi@zhuzhaoqi-desktop:~/linux$ vim s3c6410.c