• Linux 常用命令四 rmdir rm


    一、rmdir命令

    用于删除空目录:

    wang@wang:~/workpalce/python$ tree
    .
    ├── 1.txt
    ├── 2.txt
    ├── 3.txt
    ├── A
    │   └── B
    │       └── C
    │           └── D
    │               └── E
    └── B
    
    6 directories, 3 files
    wang@wang:~/workpalce/python$ rmdir B
    wang@wang:~/workpalce/python$ tree
    .
    ├── 1.txt
    ├── 2.txt
    ├── 3.txt
    └── A
        └── B
            └── C
                └── D
                    └── E
    
    5 directories, 3 files

    二、rm命令

    删除文件:

    wang@wang:~/workpalce/python$ tree
    .
    ├── 1.txt
    ├── 2.txt
    ├── 3.txt
    └── A
        └── B
            └── C
                └── D
                    └── E
    
    5 directories, 3 files
    wang@wang:~/workpalce/python$ rm 1.txt 
    wang@wang:~/workpalce/python$ tree
    .
    ├── 2.txt
    ├── 3.txt
    └── A
        └── B
            └── C
                └── D
                    └── E
    
    5 directories, 2 files

    删除有内容的目录:

    wang@wang:~/workpalce/python$ tree
    .
    ├── 2.txt
    ├── 3.txt
    └── A
        └── B
            └── C
                └── D
                    └── E
    
    5 directories, 2 files
    wang@wang:~/workpalce/python$ rm A -r
    wang@wang:~/workpalce/python$ tree
    .
    ├── 2.txt
    └── 3.txt
    
    0 directories, 2 files
  • 相关阅读:
    2. 两数相加
    1. 两数之和
    x-pack elasticsearch
    简单的文档
    PHP imagepng函数 问题
    Nginx 配置
    nginx内置变量
    TCP通信
    mysql 的一些操作
    ubuntu 软件包降级
  • 原文地址:https://www.cnblogs.com/gundan/p/8056542.html
Copyright © 2020-2023  润新知