Search code examples
linuxubuntulocateinitrd

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?


Solution

  • Quote your pattern. The shell is globbing it. Change

    sudo find -iname *initrd.img*
    

    to

    sudo find -iname "*initrd.img*"