Linux 命令行工具推荐

loskyertt Unknown

1.tldr

仓库地址:tldr下载

安装:

1
sudo pacman -S tldr

安装好后建议先执行下面这条命令来更新缓存:

1
tldr --update

这个工具可以方便查询各个命令的使用方法,比如:

1
tldr find

输出:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
>>> tldr find     

find

Find files or directories under a directory tree, recursively.
More information: https://manned.org/find.

- Find files by extension:
find root_path -name '*.ext'

- Find files matching multiple path/name patterns:
find root_path -path '**/path/**/*.ext' -or -name '*pattern*'

- Find directories matching a given name, in case-insensitive mode:
find root_path -type d -iname '*lib*'

- Find files matching a given pattern, excluding specific paths:
find root_path -name '*.py' -not -path '*/site-packages/*'

- Find files matching a given size range, limiting the recursive depth to "1":
find root_path -maxdepth 1 -size +500k -size -10M

- Run a command for each file (use `{}` within the command to access the filename):
find root_path -name '*.ext' -exec wc -l {} \;

- Find all files modified today and pass the results to a single command as arguments:
find root_path -daystart -mtime -1 -exec tar -cvf archive.tar {} \+

- Find empty files (0 byte) or directories and delete them verbosely:
find root_path -type f|d -empty -delete -print

Found 2 pages with the same name under the platforms: windows, windows.

2.fd

仓库地址:fd下载

安装:

1
sudo pacman -S fd

这是一款代替find命令的工具,语法简单且搜索效率很高。具体使用方式见仓库介绍。

  • Title: Linux 命令行工具推荐
  • Author: loskyertt
  • Created at : 2025-01-11 17:26:00
  • Updated at : 2025-01-11 11:38:28
  • Link: https://redefine.ohevan.com/2025/01/11/Linux命令行工具/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments
On this page
Linux 命令行工具推荐