![lsof -ad3-999 -c rsync 有什么作用?](https://linux22.com/image/11906/lsof%20-ad3-999%20-c%20rsync%20%E6%9C%89%E4%BB%80%E4%B9%88%E4%BD%9C%E7%94%A8%EF%BC%9F.png)
我试图查看已经运行的 rsync 和 cp 任务的进度,发现这答案让我可以看到当前发生的事情
当我转到页面man
并lsof
看到它-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.
写这篇文章的人可能放弃了理解为什么取反范围不起作用(就像我一样),而是这样写的。