If you have a very large directory, find will check each individual file, even when -path
doesn’t match, which makes it take longer to complete. Combine -o
and -prune
to omit them entirely.
find . -path '**/node_modules/**' -prune -o -type f -name '*.js' -exec grep 'import' {} +
First, use
lsblk
to list your block devices. Note the path containing your usb device. e.g./dev/sdb1
Next mount the device to an existing folder or create a new one.
mkdir -p /mnt/thumbstick mount /dev/sdb1 /mnt/thumbstick
Now you can pipe the dpkg output to the usb device.
Finally, you can unmount the stick to ensure everything is flushed. (optional)