head can show the first lines without downloading
the whole file.
Each capability is a set of methods a VFS overrides, and the commands they make
cheaper:
Built-in VFSs already implement these where their service allows. A
custom VFS overrides the methods it can answer.
Mirage still handles options and output, and reads or lists files whenever a
method returns
None.
Built-in VFSs
These tables list which built-in VFSs answer each command from their service. A command or VFS not listed reads the files as usual.Search
A recursivegrep or rg asks the service which files contain the text, and
reads only those files.
- A search a VFS does not speed up reads the files itself, up to the mount’s
walk_limit, and says so on stderr when it stops there. It never leaves a file out silently. Some patterns and flags always read every file; see Search. - A file the service’s search leaves out is not read, so
grepdoes not print a match in it. To read every file instead, set the mount’swalk_limitto-1on"@all".
One-file search
grep and rg on one table file fetch only the rows that may match, not the
whole table. The output is the same as reading the file.
Lines
head, tail, wc -l and tail -f ask the service for the lines or the
count, without reading the whole file.
Checksums
Hash commands print the hash the service stores, without reading the file. Other files are hashed by reading them.Walks
find, du, ls -R, tree, grep -r and rg get the whole folder tree in
one call, not one listing per folder.