我正在运行 lubuntu 20.04。
在 /etc/fstab 中,我挂载了我的 Debian-home 文件系统,并从那里绑定挂载了一个文件夹。
cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
UUID=a19641aa-75ea-4815-b7c3-ce4c0a3cd0c9 / ext4 defaults,discard 0 1
UUID=3bbf1ad8-b0d0-464e-a73b-9337e16d95d0 /home ext4 defaults 0 2
UUID=927f38a0-c962-47de-9361-f1730032704e swap swap defaults 0 2
# Debian-home einbinden # my debian $HOME filesystem
UUID=1ebf0f02-cdd8-44d9-80f9-7078de79e191 /media/debian-home-partition ext4 user,auto 0 2
# einzelne Ordner einbinden von debian-home # folder with Videos
/media/debian-home-partition/alex/jd2 /home/alex/jd2 none bind,defaults 0 0
tmpfs /tmp tmpfs defaults,noatime,mode=1777 0 0
debian 和 ubuntu 中的用户具有相同的名称和 (id/gid)。我可以将文件从 ubuntu $HOME mv 或 cp 到 bind 文件夹。
但不知何故 find 不起作用。
find jd2/downloads/ -name Xemnas
没有什么。
但
ls -al jd2/downloads/ | grep -i xemnas
-rw-rw-r-- 1 alex alex 305670178 Dez 31 16:18 Kingdom Hearts 3 ReMind - Roxas, Axel, Xion vs Xemnas Boss Fight (PS4 Pro) (4K) (60FPS)-AQofRl7z2u8.mp4
尝试一下调试
LANG=C
alex@Guilmon:~$ find -D tree jd2/downloads/ -name xemnas
Predicate List:
[(] [-name] [)] [-a] [-print]
Eval Tree:
pred=[-a] type=bi_op prec=and cost=Unknown est_success_rate=0,1000 no side effects
left:
pred=[-name xemnas] type=primary prec=no cost=Unknown est_success_rate=0,1000 no side effects
no children.
right:
pred=[-print] type=primary prec=no cost=Unknown est_success_rate=1,000 side effects
no children.
Normalized Eval Tree:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0,1000 no side effects
left:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0,1000 no side effects
no left.
right:
pred=[-name xemnas] type=primary prec=no cost=Nothing est_success_rate=0,1000 no side effects
no children.
right:
pred=[-print] type=primary prec=no cost=Nothing est_success_rate=1,000 side effects
no children.
Optimized Eval Tree:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0,1000 no side effects
left:
pred=[-a] type=bi_op prec=and cost=Nothing est_success_rate=0,1000 no side effects
no left.
right:
pred=[-name xemnas] type=primary prec=no cost=Nothing est_success_rate=0,1000 no side effects
no children.
right:
pred=[-print] type=primary prec=no cost=Nothing est_success_rate=1,000 side effects
no children.
Optimized command line:
-name xemnas [est success rate 0,1] -a [est success rate 0,1] -print [est success rate 1]
我的绑定挂载不正确吗?还是我的 find 命令忽略了某些内容?
答案1
命令
find <path> -name xemnas
仅匹配名称完全一致的文件xemnas
- 要等同于您的ls ... | grep -i xemnas
命令,您需要
find <path> -iname '*xemnas*'
其中*
s 是匹配零个或多个前导/尾随字符的 glob 通配符,并使-iname
匹配不区分大小写。对于您的特定情况,您还可以使用以下方法使开头的 X 不区分大小写-name '*[Xx]emnas*'