Skip to content

Instantly share code, notes, and snippets.

@navono
Last active March 7, 2023 11:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navono/b76453752f5c9b6aaf05336db2bc18a0 to your computer and use it in GitHub Desktop.
Save navono/b76453752f5c9b6aaf05336db2bc18a0 to your computer and use it in GitHub Desktop.
remove all node_modules
# 递归删除下工程内的所有node_modules
find . -name "node_modules" -type d -exec rm -rf '{}' +
# 命令拆解注释
# . 当前目录
# -name 名字匹配,指定字符串作为寻找文件或目录的范本样式;
# -type 查询文件类型。 -d 就是目录
# -exec 就是匹配后执行一些命令
# rm -rf '{}' 删除匹配到到('{}')
# + 是个骚操作
# 一个-exec只能执行一个命令,而且必须在命令后面加上终结符,终结符有两个:“;”和“+”。
# 其中";" 会对每一个find到的文件去执行一次cmd命令。而”+“让find到的文件一次性执行完cmd命令。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment