简体   繁体   中英

How to find all initrd.img* files on a system

Been working on some custom ISO for Ubuntu, so I have lots of different mounts, etc. I wanted to scan across everything to find all of the initrd.img* files, but I'm getting clocked by "features" in the find command. locate command won't work because this stuff is not installed.

developer@developer-u32-dev-VM:/$ sudo find -iname *initrd.img*
find: paths must precede expression: initrd.img.old
Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression]
developer@developer-u32-dev-VM:/$ sudo find -iname *initrd.img-*
./boot/initrd.img-3.19.0-25-generic
./boot/initrd.img-3.19.0-15-generic
./boot/initrd.img-3.19.0-23-generic

As you can see I can use find to identify the physical files, but I need to locate all of the initrd.img links.

How does one go about this?

Quote your pattern. The shell is globbing it. Change

sudo find -iname *initrd.img*

to

sudo find -iname "*initrd.img*"

查找指向initrd.img的所有符号链接

$ find -lname \*initrd.img*

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM