tips
15 tips Files
One command, setting or habit at a time about Files: what it does, the line to copy and a caveat or two.
Linux and shell 6
-
Sort a directory listing by size, with readable units.
ls -lhS /var/log -
Identify a file by its contents, whatever its extension claims.
file photo.jpg data.bin -
Sort names with numbers in them the way a person would count.
ls -v -
Read or pipe a single file from a zip archive without extracting everything.
unzip -l site.zip -
Merge files into a folder while keeping whatever is already there.
mv -n card2/*.jpg ~/Pictures/all/ -
Swaps the names of two files or directories at once, with nothing in between.
mv -T --exchange /srv/site/html /srv/site/html-new
Files and media 2
-
Quickly detect a changed or damaged file with a very fast, non-cryptographic hash.
xxhsum -H64 backup.tar > backup.xxh -
Unpack the files of a zip flat into one directory, ignoring its folder structure
unzip -j archive.zip -d out/
Access and security 1
-
Verify only the downloaded files against a big checksum list, without errors for the rest.
sha256sum -c --ignore-missing SHA256SUMS
Built-in apps 1
-
Select files in Files, tap More, then Compress to get a ZIP you can send as one attachment.
Files > More > Select > pick files > More > Compress
Files and Spotlight 1
-
Cleans up the ._ metadata files macOS leaves on USB sticks and shared folders.
dot_clean -m /Volumes/USBSTICK
Finder shortcuts 1
-
Renames many selected files at once with replace, add or numbered name formats.
Select the files > Control-click one > Rename
Mac terminal 1
-
Lists the file system calls of one app live, so you see which files it touches.
sudo fs_usage -w -f filesys Mail
Settings and services 1
-
Makes Finder skip .DS_Store files on SMB shares, which can speed up browsing.
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool TRUE
Windows 1
-
Lists only the files in a folder tree whose text contains a pattern.
Select-String -Pattern 'example.com' -List |
Nothing in this filter yet.