掌握文件查找的艺术
任务
- 使用
which
命令查找 python3
可执行文件的位置。
- 使用
whereis
命令查找与 gcc
编译器相关的所有位置。
- 使用
find
命令在 /etc
目录及其子目录中搜索所有 .conf
文件。
要求
- 所有命令必须在
~/project
目录下执行。
- 对于
find
命令,必须手动复制输出并将其粘贴到 ~/project
目录下名为 config_files.txt
的文件中,使用桌面上的文本编辑器完成此操作。
- 使用每个命令的适当选项以确保结果准确。
find
命令应仅搜索具有确切 .conf
扩展名的文件(而非目录)。
示例
以下是终端输入和输出的示例(实际结果可能因系统配置而异):
$ ░░░░░ ░░░░░░░
/usr/bin/python3
$ ░░░░░░░ ░░░
gcc: /usr/bin/gcc /usr/lib/gcc /usr/share/gcc /usr/share/man/man1/gcc.1.gz
$ cat ~/project/config_files.txt
/etc/adduser.conf
/etc/ca-certificates.conf
/etc/debconf.conf
/etc/deluser.conf
/etc/host.conf
/etc/ldap.conf
/etc/ld.so.conf
/etc/resolv.conf
...