当前位置:首页 > linux > 正文

linux怎么查找文件夹位置

  • linux
  • 2024-05-03 12:19:55
  • 4360

1. find
bash
find / -name 文件夹名称
例如,查找名为 "Documents" 的文件夹:
bash
find / -name Documents
2. locate
bash
locate 文件夹名称
例如,查找名为 "Downloads" 的文件夹:
bash
locate Downloads
3. which
bash
which 文件夹名称
示例:查找 /usr/bin/games 文件夹:
bash
which games
4. whereis
bash
whereis 文件夹名称
示例:查找 /usr/share/man/man1 目录:
bash
whereis man1
5. updatedb
bash
updatedb
在使用 locate 命令之前,需要先运行 updatedb 命令来更新数据库。
其他提示
使用 -print 选项将结果打印到终端:
bash
find / -name 文件夹名称 -print
使用 -type d 选项仅查找目录:
bash
find / -name 文件夹名称 -type d
使用 -exec 选项执行命令(例如,打开文件夹):
bash
find / -name 文件夹名称 -type d -exec ls -ld "{}" \;