zoukankan      html  css  js  c++  java
  • 2.centos 7清空文件和文件夹

    1.清空文件

      测试文件:a.txt

      1)方法一,[root@centos test]# > a.txt  

    [root@centos test]# cat a.txt 
    1hjbfao
    hjkl23o
    ujl1nsd
    [root@centos test]# > a.txt 
    [root@centos test]# cat a.txt 
    [root@centos test]# 

      2)方法二,  [root@centos test]# echo "" >a.txt

    [root@centos test]# cat a.txt 
    1hjbfao
    hjkl23o
    ujl1nsd
    [root@centos test]# echo "" >a.txt 
    [root@centos test]# cat a.txt 
    [root@centos test]# 

      3)方法三,[root@centos test]# cat /dev/null > a.txt  

    [root@centos test]# cat a.txt 
    1hjbfao
    hjkl23o
    ujl1nsd
    [root@centos test]# cat /dev/null > a.txt 
    [root@centos test]# cat a.txt 
    [root@centos test]# 

    2.清空文件夹

      在目录要删除的目录下面执行 rm -rf *  

    [root@centos test01]# ll
    total 4
    -rw-r--r--. 1 root root  0 Aug 26 23:36 a.txt
    -rw-r--r--. 1 root root 24 Aug 26 23:36 b.txt
    [root@centos test01]# cd ..
    [root@centos ~]# rm -rf test01/*
    [root@centos ~]# ls test01/
    [root@centos ~]#
  • 相关阅读:
    setCookie
    EF getCookie
    EF
    Dapper修改
    Dapper显示
    Dapper上传图片
    Dapper存储过程分页
    Azure Function(.Net Cor框架)读取配置文件
    .Net Core3.1中出现AssemblyInfo特性重复
    YAML配置文件 基础学习
  • 原文地址:https://www.cnblogs.com/xinghen1216/p/13565555.html
Copyright © 2011-2022 走看看