- 已关闭。**此问题为not about programming or software development。当前不接受答案。
此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题有关,您可以留下评论,说明在何处可以回答此问题。
15小时前关门了。
Improve this question
因此,在Linux Mint上多次使用locate命令后,我遇到了每个查询都在/timeshift/目录中返回一行又一行结果的问题-Linux Mint将该目录用作操作系统保存点。
如果我使用locate anaconda activate.sh
,我可能会得到:
/home/user/.anaconda3/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts
/conda-activate.sh
/home/user/.anaconda3/pkgs/conda-4.12.0-py39h06a4308_0/info/test/tests/test-recipes/activate_deactivate_package/src/etc/conda/activate.d/activate.sh
/home/user/.anaconda3/pkgs/spyder-5.1.5-py39h06a4308_1/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh
/timeshift/snapshots/2023-01-09_15-00-01/localhost/home/user/.anaconda3/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh
/timeshift/snapshots/2023-01-09_15-00-01/localhost/home/user/.anaconda3/pkgs/conda-4.12.0-py39h06a4308_0/info/test/tests/test-recipes/activate_deactivate_package/src/etc/conda/activate.d/activate.sh
/timeshift/snapshots/2023-01-09_15-00-01/localhost/home/user/.anaconda3/pkgs/conda-4.12.0-py39h06a4308_0/info/test/tests/test-recipes/activate_deactivate_package/src/etc/conda/deactivate.d/deactivate.sh
/timeshift/snapshots/2023-01-09_15-00-01/localhost/home/user/.anaconda3/pkgs/spyder-5.1.5-py39h06a4308_1/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh
/timeshift/snapshots/2023-02-10_04-00-01/localhost/home/user/.anaconda3/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh
/timeshift/snapshots/2023-02-10_04-00-01/localhost/home/user/.anaconda3/pkgs/conda-4.12.0-py39h06a4308_0/info/test/tests/test-recipes/activate_deactivate_package/src/etc/conda/activate.d/activate.sh
/timeshift/snapshots/2023-02-14_20-00-01/localhost/home/user/.anaconda3/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh
/timeshift/snapshots/2023-02-14_20-00-01/localhost/home/user/.anaconda3/pkgs/conda-4.12.0-py39h06a4308_0/info/test/tests/test-recipes/activate_deactivate_package/src/etc/conda/activate.d/activate.sh
/timeshift/snapshots/2023-02-14_20-00-01/localhost/home/user/.anaconda3/pkgs/conda-4.12.0-py39h06a4308_0/info/test/tests/test-recipes/activate_deactivate_package/src/etc/conda/deactivate.d/deactivate.sh
/timeshift/snapshots/2023-02-14_20-00-01/localhost/home/user/.anaconda3/pkgs/spyder-5.1.5-py39h06a4308_1/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh
/timeshift/snapshots/2023-02-15_21-00-01/localhost/home/user/.anaconda3/lib/python3.9/site-packages/spyder/plugins/ipythonconsole/scripts/conda-activate.sh
/timeshift/snapshots/2023-02-15_21-00-01/localhost/home/user/.anaconda3/pkgs/conda-4.12.0-py39h06a4308_0/info/test/tests/test-recipes/activate_deactivate_package/src/etc/conda/activate.d/activate.sh
只有前三个结果是相关的,那么如何排除目录呢?
1条答案
按热度按时间m1m5dgzv1#
使用grep手动排除目录
可以使用-v选项让grep输出所有与提供的Regex * 不 * 匹配的元素,如下所示:
这将只打印不包含字符串
/timeshift/
的路径永久排除目录
由于时移目录的问题经常重复出现,您可能希望将其从所有位置查询中永久排除。
根据
updatedb
文档,您可以将/timeshift
添加到/etc/updatedb.conf
中的PRUNEPATHS=
。运行updatedb
后,所有plocate
查询现在应排除/timeshift
目录。