GitHub - tracyspacy/fli: cli tool to list directory content · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
tracyspacy
fli
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star<br>14
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>78 Commits<br>78 Commits
.cargo
.cargo
src
src
.gitattributes
.gitattributes
.gitignore
.gitignore
Cargo.lock
Cargo.lock
Cargo.toml
Cargo.toml
LICENSE
LICENSE
README.md
README.md
View all files
Repository files navigation
fli
fli is a cli tool to list directory content
Why
I have access to my raspberry pi zero via ssh only. As for me it is hard to differentiate types of files etc based on colors, I needed something more readable and clear like picture/icon or emoji as I ended up with etc. And I decided to build fli and since ls is obviosly preinstalled on almost any machine, the second requirement for fli as a complimentary tool, is to be tiny.
Thus fli is a tiny (18KB), easy to read file listing tool.
While working on fli, another aspect of my interest and motivation is to check if with Rust one can build coreutils-like tools, but faster and smaller.
Readability : Nice readability thanks to use of emojis (📄 and 🗂️) instead of text coloring.
Speed : By default directory entries are streamed directly from readdir() to stdout without heap allocation.
Size: Since rust std contributes heavily to binary size, this project is no_std + libc (it contains unsafe code blocks ).
Binary size:
M series mac: 51 KB ,
rpi zero w : 18 KB .
Current display options:
Default fli : short (name and type) sorted by name<br>FLAGS :
-l : long listing format (name, type, metadata). Default sorting is by name .
-S : with -l long listing format sorted by size , smallest first.
-t : with -l long listing format sorted by time , oldest first.
-U : do not sort, list entries in directory order. Alignment is fixed-sized (20 chars for size and n_link) - direct stream, no heap allocation.
-2 : text output for types : instead of default emojis.
-0 : color output for types : Dir: Blue, File: Green, Link : Cyan.
New display options may be added soon.
Build
Build: cargo build --release
Build with cross for raspberry pi zero w: cross build --release --target arm-unknown-linux-gnueabihf
Copy to rpi : scp /target/arm-unknown-linux-gnueabihf/release/fli @.local:
View
MISC
//arm-linux-gnueabihf<br>file fli<br>fli: ELF 32-bit LSB pie executable, ARM, EABI5 version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-armhf.so.3, for GNU/Linux 4.19.255, stripped
readelf -d fli | grep NEEDED<br>0x00000001 (NEEDED) Shared library: [libc.so.6]<br>0x00000001 (NEEDED) Shared library: [libgcc_s.so.1]
size fli<br>text data bss dec hex filename<br>15452 504 4 15960 3e58 fli
Benchmarks
it is faster than ls, but it is not the main focus. Still probably need a more sophisticated benchmark later
//20k empty files, sorted by name, macos m-series.<br>Benchmark 1: /Users/tracyspacy/Documents/GitHub/fli/target/release/fli -l -U<br>Time (mean ± σ): 39.8 ms ± 0.6 ms [User: 14.0 ms, System: 24.6 ms]<br>Range (min … max): 38.5 ms … 42.6 ms 60 runs
Benchmark 2: /Users/tracyspacy/Documents/GitHub/fli/target/release/fli -l<br>Time (mean ± σ): 46.3 ms ± 0.4 ms [User: 19.6 ms, System: 25.3 ms]<br>Range (min … max): 45.0 ms … 47.4 ms 55 runs
Benchmark 3: /Users/tracyspacy/Documents/GitHub/fli/target/release/fli -l -t<br>Time (mean ± σ): 40.8 ms ± 0.6 ms [User: 14.3 ms, System: 25.0 ms]<br>Range (min … max): 39.4 ms … 42.8 ms 62 runs
Benchmark 4: ls -l<br>Time (mean ± σ): 145.5 ms ± 1.0 ms [User: 82.3 ms, System: 61.8 ms]<br>Range (min … max): 144.6 ms … 148.3 ms 19 runs
Benchmark 5: ls -l -U<br>Time (mean ± σ): 145.4 ms ± 0.3 ms [User: 82.4 ms, System: 61.7 ms]<br>Range (min … max): 144.6 ms … 146.0 ms 19 runs
Benchmark 6: ls -l -t<br>Time (mean ± σ): 98.2 ms ± 0.5 ms [User: 35.7 ms, System: 61.2 ms]<br>Range (min … max): 96.8 ms … 99.3 ms 28 runs
Summary<br>/Users/tracyspacy/Documents/GitHub/fli/target/release/fli -l -U ran<br>1.02 ± 0.02 times faster than...