<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Find on Michael’s Domain</title><link>https://jeltsch.org/en/tags/find/</link><description>Recent content in Find on Michael’s Domain</description><generator>Hugo</generator><language>en-us</language><copyright>Copyright © 2002 - 2026 Michael Jeltsch.</copyright><lastBuildDate>Fri, 24 Jul 2026 00:18:18 +0300</lastBuildDate><atom:link href="https://jeltsch.org/en/tags/find/index.xml" rel="self" type="application/rss+xml"/><item><title>The find command on an old Asustor</title><link>https://jeltsch.org/en/busybox_find/</link><pubDate>Sat, 21 Mar 2026 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/busybox_find/</guid><description>&lt;p&gt;Instead of clicking randomly through endless hierarchies of folders on the web GUI of Asustor, you can just ssh into the device and search on the command line using &lt;em&gt;find&lt;/em&gt;. However, there are important differences between the &lt;em&gt;find&lt;/em&gt; command on contemporary Linux systems and the &lt;em&gt;find&lt;/em&gt; command of ADM (the OS of Asustor NAS servers). My EOL Asustor (AS-304T) uses 3.5.9.RWM1, which uses the BusyBox &lt;em&gt;find&lt;/em&gt; v1.19.3, while my Ubuntu Linux uses GNU find 4.9.0. BusyBox &lt;em&gt;find&lt;/em&gt; trades features for a small binary footprint and is locked to GPL-2. On the GPL-3 side on Linux, significant new features and performance enhancements have been added. Here is the &lt;em&gt;find&lt;/em&gt; command that you need if you want to search all disks on your Asustor:&lt;/p&gt;</description></item><item><title>Finding files with find</title><link>https://jeltsch.org/en/finding_files_with_find/</link><pubDate>Mon, 24 Sep 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/finding_files_with_find/</guid><description>&lt;p&gt;Finding files with the &lt;em&gt;find&lt;/em&gt; command is actually more difficult than it should be. This finds and lists the largest files (more than 200 MB) on the whole file system:&lt;code&gt;find / -type f -size +200000k -exec ls -lh {} \; | awk '{ print $9 &amp;quot;: &amp;quot; $5 }'&lt;/code&gt;The same, but simpler syntax:&lt;code&gt;find / -size +200M -ls&lt;/code&gt;This finds the most recently changed files under the current directory:&lt;code&gt;find . -type f -printf '%TY-%Tm-%Td %TT %p\n' | sort&lt;/code&gt;And this command pipes the results of the &lt;em&gt;find&lt;/em&gt; command into another command. First &lt;em&gt;find&lt;/em&gt; looks for Quicktime movies (based on the file extension .mov) and then &lt;em&gt;ffmpeg&lt;/em&gt; converts them into avi files.&lt;code&gt;find . -name '*.mov' -exec sh -c 'ffmpeg -i &amp;quot;$0&amp;quot; -sameq &amp;quot;${0%%.mov}.avi&amp;quot;' {} \;&lt;/code&gt;This commands finds and lists all filenames that contain the string &amp;lsquo;bitcoin&amp;rsquo;:&lt;code&gt;find . -name '*bitcoin*' -ls&lt;/code&gt;And this command finds Quicktime movies and deletes them:&lt;code&gt;find . -name '*.mov' -exec sh -c 'rm &amp;quot;$0&amp;quot;' {} \;&lt;/code&gt;And this finds files that have been modified (created or updated) during the last 2 minutes:&lt;code&gt;find . -cmin 2&lt;/code&gt;This finds crap which you copied over from a Macintosh and which you don&amp;rsquo;t need under Linux:&lt;code&gt;find . -name '*.DS_Store' -type f -delete&lt;/code&gt;Similar story here:&lt;code&gt;find . -name '._*' -type f -delete&lt;/code&gt;When being in the root directory, this should find all files with the name &amp;lsquo;syncthing&amp;rsquo;:&lt;code&gt;find . -name 'syncthing' -ls&lt;/code&gt;And this finds all files larger than 200MB in the /home directory:&lt;code&gt;find /home -size +200M -ls&lt;/code&gt;Find recursively all files that end in .gz and count them:&lt;code&gt;find . -name '*.gz' | wc -l&lt;/code&gt;Find recursively all files that do NOT end in .gz and count them:&lt;code&gt;find . -not -name '*.gz' | wc -l&lt;/code&gt;When you want to search recursively through the content of text files, you need to use the grep command:&lt;code&gt;grep -rnw '/path/to/target-directory' -e 'pattern'&lt;/code&gt;When you search for PDF files modified in October 2024:&lt;code&gt;sudo find / -type f -name &amp;quot;*.pdf&amp;quot; -newermt &amp;quot;2024-10-01&amp;quot; ! -newermt &amp;quot;2024-11-01&amp;quot; 2&amp;gt;/dev/null&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Piping the output of find into a new command (find, xargs)</title><link>https://jeltsch.org/en/piping_the_output_of_find_into_a_new_command_find_xargs/</link><pubDate>Wed, 23 May 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/piping_the_output_of_find_into_a_new_command_find_xargs/</guid><description>&lt;p&gt;E.g. to change the permissions of all directories:&lt;code&gt;find . -type d -print | xargs /bin/chmod ug+rx&lt;/code&gt;To be able to handle directory names with special characters&lt;code&gt;find . -type d -print0 | xargs -0 /bin/chmod ug+rx&lt;/code&gt;In order to find all tif files in the current directory or below and to compress them (using the ImageMagick &amp;ldquo;mogrify&amp;rdquo; command and LZW compression):&lt;code&gt;find . -name '*.tif' -print | xargs mogrify -compress LZW&lt;/code&gt;Apart from the &amp;ldquo;xargs&amp;rdquo; method, some command (including find) accept the &amp;ldquo;-exec&amp;rdquo; argument. The following finds all files in the current directory that are smaller than 4k and deletes them:&lt;code&gt;find . -size -4k -exec rm {} \;&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Find and replace with perl</title><link>https://jeltsch.org/en/find_and_replace_with_perl/</link><pubDate>Sun, 28 Jan 2007 00:00:00 +0000</pubDate><guid>https://jeltsch.org/en/find_and_replace_with_perl/</guid><description>&lt;p&gt;To replace the string jeltsch.blogspot.com by the string mnm.no-ip.com/blog you can use perl:&lt;code&gt;perl -pi.bak -e 's|jeltsch.blogspot.com|mnm.no-ip.com\/blog|g' *.html&lt;/code&gt; If you want to do a recursive replacement on a directory tree you can try:&lt;code&gt;perl -pi.bak -e 's|jeltsch.blogspot.com|mnm.no-ip.com\/blog|g' &lt;/code&gt;find jeltsch.org -name &amp;lsquo;*.html&amp;rsquo;``&lt;/p&gt;</description></item></channel></rss>