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并将其转换成特定命令的命令参数。
  • 相关阅读:
    Windows服务BAT命令-安装、卸载、启动、停止
    身份认证
    密钥管理概述
    快速上手几个Linux命令
    递归
    数字签名的实现方案
    数字签名
    密码学基础
    你可以把Linux内核当成一家软件外包公司的老板
    数学归纳法
  • 原文地址:https://www.cnblogs.com/bukekangli/p/4502083.html
Copyright © 2011-2022 走看看