Crates.io | sz-cli |
lib.rs | sz-cli |
version | 0.1.0 |
source | src |
created_at | 2023-05-26 15:16:23.592102 |
updated_at | 2023-05-26 15:16:23.592102 |
description | Disk usage CLI. |
homepage | |
repository | |
max_upload_size | |
id | 875115 |
size | 43,393 |
A pragmatic way to view your file sizes. Think of it as an easier-to-use and more intuitive alternative to the du coreutil.
This project is still under development and might contain bugs and crappy code! Please open issues/PRs if you find something janky.
Let's take a look at how we can use this utility in a directory.
sz .
this will be the output:
file/dir name | size
---------------+---------
sz | 41.52KB
10 files parsed
sz . -l
-g
and -i
flag respectively.sz . -l -i -g
-n
argument or include the
-L
flag to list all the items.sz . -l -i -g -n 30 # show me the first 30 items
sz . -l -i -g -L # show me all the files
-d
and -a
flags.sz . -l -d -n 5 # returns the 5 largest files in the current directory
sz . -l -a -n 6 # returns the 6 smallest files in the current directory
-D
flag.
this flag will only show directories with the parent same as the path provided.
it will not list any files.sz ~/Documents/rl -l -D
-R
flag.sz ~/Documents/rl -l -D -R
note that you can use all the options previously mentioned with the -D
flag too.
# shows the 3 largest directories in this path (including gitignored or hidden)
sz ~/Documents/rl -l -D -R -i -g -d -n 3
-e
flag to exclude directoriessz ~/Documents/rl -l -D -R -d -e ~/Documents/rl/public/ ~/Documents/rl/assets/
warning: this arg doesn't really work with the -i
or -g
-s
flag to show the total line count of all the files parsed. Run this only with
UTF-8 encoded files, obviously.sz ./src -l -s
The options are pretty simple yet powerful:
Options:
-d, --sort-files-desc Sort items by size in descending order
-a, --sort-files-asc Sort items by size in ascending order
-i, --include-hidden Include hidden files
-l, --list-files List the files in the directory
-L, --list-all List all files in the directory even if directory count exceeds 50
-g, --include-gitignored Include gitignored files
-e, --exclude-dirs <EXCLUDE_DIRS>... Directories to exclude
-n, --num-files <NUM_FILES> Number of files to list
-D, --only-dirs Show only directories
-R, --recursive-dirs Recursively list directories (Only to be used with -D flag)
-s, --show-lines Show total line count for items
-h, --help Print help
Run sz -h
to view this help message.