lsof -ad3-999 -c rsync 有什么作用?

lsof -ad3-999 -c rsync 有什么作用?

我试图查看已经运行的 rsync 和 cp 任务的进度,发现答案让我可以看到当前发生的事情

当我转到页面manlsof看到它-c用于选择cp要查看的进程(在下面的示例中)时:

   -a       causes list selection options to be ANDed, as described above.

   -b       causes lsof to avoid kernel functions that might block - lstat(2), readlink(2), and stat(2).

但我不太明白与3-999

有什么lsof -ad3-999 -c cp作用?

答案1

-d3-999只是从列表中排除标准文件描述符 (0,1,2)。用于-d指定 fd 的列表或范围:

-d s     specifies  a list of file descriptors (FDs) to exclude from or
         include in the output listing.  The file descriptors are spec-
         ified  in  the  comma-separated  set  s  -  e.g., ``cwd,1,3'',
         ``^6,^2''.  (There should be no spaces in the set.)

         The list is an exclusion list if all entries of the set  begin
         with  `^'.   It  is  an inclusion list if no entry begins with
         `^'.  Mixed lists are not permitted.

         A file descriptor number range may be in the set  as  long  as
         neither  member  is  empty,  both members are numbers, and the
         ending member is larger than the starting one - e.g.,  ``0-7''
         or  ``3-10''.   Ranges  may be specified for exclusion if they
         have the  `^'  prefix  -  e.g.,  ``^0-7''  excludes  all  file
         descriptors 0 through 7.

写这篇文章的人可能放弃了理解为什么取反范围不起作用(就像我一样),而是这样写的。

相关内容