Bash 又一场需要解释的狂欢

Bash 又一场需要解释的狂欢,bash,unix,find,Bash,Unix,Find,这里是另一个需要解释的bash命令。有人能解释一下$find命令的选项是什么意思吗?我知道该命令会找到0字节的文件并将其丢弃 $find . – type f –size 0 | xargs rm ls -ld 这是什么意思。什么意思? |是什么意思 什么是f型-尺寸0 什么是xargs -ld是什么意思 rm=删除 ls=list是当前目录 |将一个命令(find)的输出导入另一个命令(xargs)的输入 我建议您使用man find、man xargs和man ls来确定find的选项以及

这里是另一个需要解释的bash命令。有人能解释一下$find命令的选项是什么意思吗?我知道该命令会找到0字节的文件并将其丢弃

$find . – type f –size 0 | xargs rm ls -ld
这是什么意思。什么意思? |是什么意思

什么是f型-尺寸0

什么是xargs

-ld是什么意思

rm=删除
ls=list是当前目录

|
将一个命令(find)的输出导入另一个命令(xargs)的输入


我建议您使用
man find
man xargs
man ls
来确定
find
的选项以及
xargs
ls
的具体操作。

是当前目录

|
将一个命令(find)的输出导入另一个命令(xargs)的输入


我建议您使用
man-find
man-xargs
man-ls
来确定
find
的选项以及
xargs
ls
的具体操作。

find使用一个参数:用作搜索根的目录。所有其他参数都作为选项传入

find . -type f -size 0

find     :  The name of the program.
.        :  The directory to use as the root for the search.
-type f  :  Find only regular files. (Excludes directories, sym links, etc.)
-size 0  :  Finds only empty files.
find命令的输出将是一个空文件列表。然后将该输出馈送到xargs。xargs是一个程序,它接受字符串列表作为输入,然后对所有字符串执行给定命令

您键入的命令
xargs rm ls-ld
出现错误。我将使用
xargsrm
作为示例

xargs rm

xargs    :  The name of the program.
rm       :  The command to run on each file.

因此,完整的命令
find-键入f-size 0 | xargs rm
查找并删除所有空文件。

Find接受一个参数:用作搜索根目录的目录。所有其他参数都作为选项传入

find . -type f -size 0

find     :  The name of the program.
.        :  The directory to use as the root for the search.
-type f  :  Find only regular files. (Excludes directories, sym links, etc.)
-size 0  :  Finds only empty files.
find命令的输出将是一个空文件列表。然后将该输出馈送到xargs。xargs是一个程序,它接受字符串列表作为输入,然后对所有字符串执行给定命令

您键入的命令
xargs rm ls-ld
出现错误。我将使用
xargsrm
作为示例

xargs rm

xargs    :  The name of the program.
rm       :  The command to run on each file.

因此,完整的命令
find-键入f-size 0 | xargs rm
查找并删除所有空文件。

xargs将列表拆分为子列表。找到。表示从当前目录开始。f指定文件,即非软链接或硬链接、特殊文件或驱动程序。使用恰当的方法查找。apropos xargsy您的命令似乎格式不正确。它不会像您键入的那样工作。xargs将列表拆分为子列表。找到。表示从当前目录开始。f指定文件,即非软链接或硬链接、特殊文件或驱动程序。使用恰当的方法查找。apropos xargsy您的命令似乎格式不正确。它不会像您键入的那样工作。