diff --git a/README.md b/README.md index 1fbc9e7..291d34e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ pairing with smart people at Hashrocket. For a steady stream of TILs, [sign up for my newsletter](https://crafty-builder-6996.ck.page/e169c61186). -_1314 TILs and counting..._ +_1315 TILs and counting..._ --- @@ -1261,6 +1261,7 @@ _1314 TILs and counting..._ - [Figure Out The Week Of The Year From The Terminal](unix/figure-out-the-week-of-the-year-from-the-terminal.md) - [File Type Info With File](unix/file-type-info-with-file.md) - [Find All Files Matching A Name With fd](unix/find-all-files-matching-a-name-with-fd.md) +- [Find All Files With A Specific Extension With fd](unix/find-all-files-with-a-specific-extension-with-fd.md) - [Find A File Installed By Brew](unix/find-a-file-installed-by-brew.md) - [Find Duplicate Lines In A File](unix/find-duplicate-lines-in-a-file.md) - [Find Files With fd](unix/find-files-with-fd.md) diff --git a/unix/find-all-files-with-a-specific-extension-with-fd.md b/unix/find-all-files-with-a-specific-extension-with-fd.md new file mode 100644 index 0000000..c8eb0c2 --- /dev/null +++ b/unix/find-all-files-with-a-specific-extension-with-fd.md @@ -0,0 +1,24 @@ +# Find All Files With A Specific Extension With fd + +The best way with [`fd`](https://github.com/sharkdp/fd) to match on files with +a specific extension is to use the `-e` flag. + +Here is how you'd find all `.ts` files: + +```bash +$ fd -e ts +``` + +You can use the flag multiple times to specify multiple file extensions. This +will turn up all TypeScript and JavaScript files: + +```bash +$ fd -e ts -e js +``` + +Alternatively, you can use regex in the filename pattern to match on several +file extensions like so: + +```bash +$ fd '.*\.(js|ts|jsx|tsx)$' +```