find 命令

find 命令用来在目录树里查找文件。本文主要介绍 GNU find. 它从每个 starting-point 开始递归搜索,通过求值 expression 的真值来确定输出结果。

find 的命令行组成

example-of-find

  • Options
  • Starting-point
  • Expression
    • Tests
    • Actions
    • Global options
    • Position options
    • Operators

Examples

  • 只在当前目录搜索(不递归)不以 f 或 g 或 h 开头的目录

    • find . -maxdepth 1 -name '[^fgh]*' -type d
      • -type d: 找目录
      • -type f: 找文件(不包括 symbolic link)
      • -type l: 找符号链接文件
  • 排除/proc 和 /tmp 这两个目录

    • find / -path /proc -prune -o -path /tmp -prune -o -name "README.md"
      • -prune 告诉 find 跳过前面的目录,也可以用 \( -o \) 将多个 -path 合并,只保留一个 -prune
  • 只在当前目录查找除了指定及隐藏目录以外的所有目录,打印并删除

    • find -maxdepth 1 \( -path ./gh -o -path ./aaa -o -path ./mesa-install -o -path ./1.3.290.0 -o -path ./1.3.280.1 \) -prune -o -type d ! -name ".*" -print -exec rm -rf {} \;
      • 注意匹配隐藏目录时用 .*, . 在 shell 里不是通配符
      • -print: 不让 ./gh, ./aaa 这些目录出现在 find 命令的输出结果中
  • 查找 ~/gh 目录下只有文件属主(u)有执行权限(x)的文件 (精确匹配文件的 permission bits)

    • find ~/gh -perm u=x -type f
  • 查找 ~/gh 目录下文件属主(u)有执行权限(x) 的文件(组用户(g)或其它用户(o)可能有或没有执行权限)

    • find ~/gh -perm -u=x -type f

Geometry Shader Input Layout Qualifiers

Geometry shader只能在接口限定符(interface qualifier)in前加Input Layout Qualifiers, 不能在输入块(input block), 块成员(block member), 或变量声明(variable declaration)前加Input Layout Qualifiers。

这些Input Layout Qualifiers有

Read more »

A language that doesn’t affect the way you think about programming, is not worth knowing.

Alan J. Perlis, Recipient of 1966 Turing Award

Read more »

最近在两个地方看到nightly这个词:

drm-tipdrm/drm-tip (我也不知道这两个仓库有什么区别,除了它们的Owner不同)

DRM current development and nightly trees

Read more »

简介

弈城围棋是弈城围棋网推出的一款围棋学习和网络对战的 App. 它可安装在包括 Windows, Android, iOS, iPad, MacOS 在内的各个平台。

Read more »

OpenGL Pipeline

OpenGL Pipeline Stage Flowchart

说明:

  1. 蓝色框表示是Programmable Shader Stages
  2. 虚线框表示是Optional Shader Stages

C++中的模板

C++中的模板可分为class template和function template. 它们之间存在不同,例如,function template不能partially specialized(偏特化)

Read more »

1%定律

1
python -c "print(1.01**365)"

37.78343433288728

每天提升1%, 一年后提升近38倍。

Task State

stateDiagram-v2
    R: running
    S: sleeping
    D: disk sleep
    T: stopped
    t: tracing stop
    X: dead
    Z: zombie
    P: parked
    I: idle

    R --> S: schedule_timeout()
    R --> D: Wait for Disk I/O
    R --> T: SIGTSTP
    R --> t: gdb/strace
    S --> R: wake_up_process()
    D --> R: I/O Completed
    T --> R: SIGCONT
    T --> t: gdb/strace
    T --> Z: SIGKILL But Sth Wrong with Its Parent
    R --> Z: Exit But Sth Wrong with Its Parent
    t --> T: Quit gdb
Read more »
0%