Views:
715,564β
Votes: 4β
Tags:
directory
search
regex
Link:
π See Original Answer on Ask Ubuntu β§ π
URL:
https://askubuntu.com/q/1162893
Title:
How to search for all the files starting with the name "ABC" in a directory?
ID:
/2019/08/02/How-to-search-for-all-the-files-starting-with-the-name-_ABC_-in-a-directory_
Created:
August 2, 2019
Edited: August 2, 2019
Upload:
September 15, 2024
Layout: post
TOC:
false
Navigation: false
Copy to clipboard: false
If you donβt know the directory the ABC*
files are located in, and you have millions of files, the locate
command is the fastest method.
$ locate /ABC
/mnt/clone/home/rick/.cache/mozilla/firefox/9fu0cuql.default/cache2/entries/ABC6AD2FEC16465049B48D39FD2FE538258F2A34
/mnt/clone/home/rick/.cache/mozilla/firefox/9fu0cuql.default/cache2/entries/ABCBFDA54262F47253F95ED6ED4131A465EE0E39
/mnt/clone/usr/src/linux-headers-5.0.1-050001/tools/lib/lockdep/tests/ABCABC.sh
/mnt/clone/usr/src/linux-headers-5.0.1-050001/tools/lib/lockdep/tests/ABCDBCDA.sh
/mnt/clone/usr/src/linux-headers-5.0.1-050001/tools/lib/lockdep/tests/ABCDBDDA.sh
/mnt/old/home/rick/.cache/mozilla/firefox/3vkvi6ov.default/cache2/entries/ABC0C99FCEABAD0C6AA2078CD025A1CDE48D7BA1
/usr/src/linux-headers-5.0.1-050001/tools/lib/lockdep/tests/ABCABC.sh
/usr/src/linux-headers-5.0.1-050001/tools/lib/lockdep/tests/ABCDBCDA.sh
/usr/src/linux-headers-5.0.1-050001/tools/lib/lockdep/tests/ABCDBDDA.sh
Notes:
- The above command takes 1 second to run on 1 million files.
- In comparison the
find
command starting at/
root directory will a very long time and generate many permission errors. - If files were created today you must run
sudo updatedb
first.