linux文件的创建/复制/移动/删除等命令详解 touch,mkdir,cp,mov,rm命令详解linux系统文件管理

linux文件管理之:创建/复制/移动/删除

============================================================

==创建

 

    创建文件

    touch 文件            无此文件则创建,有则只是修改时间

    例如:

[[email protected]]# touch file1.txt

    如果本目录包含200012040735.21.a.c这个文件

[[email protected]]# touch -t 200012040735.21.a.c      修改时间为:2014年2月21号7点35分21秒

 

    创建目录

    mkdir 目录

    例如:

 

[[email protected]]# mkdir /home/dir2 /home/dir3
[[email protected]]# mkdir /home/{dir4,dir5}	或	/home/dir{4,5}
[[email protected]]# mkdir /home/gao{1..10}.txt
 

 

     mkdir-v显示创建文件的详 细信息

 

     mkdir-p递归创建

 

============================================================

==复制

 

     cp源目标

    例如:

 

[[email protected]]# cp install.log /home/dir1
[[email protected]]# cp -r uplayer/ /home/dir1	如果目标加上新文件名字,拷贝并改名字
 

 

 

 

============================================================

==移动

 

      mv源目标

    例如:

 

[[email protected]]# mv file2 /home/dir3   将file2移动到/home/dir3里
[[email protected]]# mv file4 file5        将file4重命名为file5,当前位置里的移动就是重命名
 

 

 

 

============================================================

==删除 

    例如:

 

[[email protected]]# rm -rf dir1     这种方法避免误删重要的目录,所以先到目录下,在去删除文件
 

 

# rm -r 递归

# rm -f force强制

# rm -v 详细过程

 

猜你喜欢

转载自gaoyaohuachina.iteye.com/blog/2020373
今日推荐