zoukankan      html  css  js  c++  java
  • Linux Command Tips

    1.delete all executable files under certain directory

    find /directory -type f -executable -delete

    or

    find /directory  -type f -executable -exec rm -f {} ;

    Above command will delete the executable files in sub-directory.

    To specifically delete all executable files in your home directory (not in sub-directories) and ask you whether you want to delete each file you can do something like

    find ~ -type f -executable -maxdepth 0 -exec rm -i {} ;

    2.删除子目录下所有后缀名相同的文件

    //以 .cpp为例
    find -name "*.cpp" | xargs rm
    • find命令将在当前目录下查找子目录与文件,查找结果包含符合条件的子目录和当前目录及子目录的文件(search for files in a directory hierarch)
    • xargs命令是给其他命令传递参数的一个过滤器,也是组合多个命令的一个工具。它擅长将标准输入数据转换成命令行参数,xargs能够处理管道或者stdin并将其转换成特定命令的命令参数。
  • 相关阅读:
    使用Python往手机发送短信(基于twilio模块)
    春&风
    故乡
    非常完美
    风 记忆
    风誓
    MATLAB的循环结构
    你要的快乐
    夕颜
    MATLAB的基本元素
  • 原文地址:https://www.cnblogs.com/bukekangli/p/4502083.html
Copyright © 2011-2022 走看看