haensl / bytes

A shell utility to retrieve the disk space consumed by files within a directory

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bytes

Build Status

bytes is a bash utility to calculate the disk space consumed by files within a directory.

Installation

Linux/OSX from source

  1. Clone this repository
  2. cd into the repository
  3. make install

OSX via Homebrew

  1. brew tap haensl/haensl
  2. brew install bytes

Usage

To calculate the total number of bytes consumed by all visible (i.e. non-dot-) files within the current directory (non-recursive), simply enter

bytes

in your terminal.

You can also specify a different directory to calculate the file-size total for:

bytes ~/some/dir

If you want to display the result in a different unit (e.g. kilobytes or megabytes), use the -u option to specify the desired unit.

If you want to include hidden files, i.e. dot-files, in the total, use the -a option.

If you want to include subdirectories into the calculation, use the -r option.

See the Options section for a full list of available options.

Options

-a | --all

Include dot-files a.k.a. hidden files into the total.

-h | --help

Display usage information.

-n | --newline

Do not print a trailing newline character.

-p | --precision <precision>

Specify the desired floating point precision (default: 3).

-r | --recursive

If set, bytes recursively traverses subdirectories. (default: false)

-u | --unit <b | kb | mb | gb | tb>

Use this option to specify the desired unit for the disk space output. Supported units are:

  • b = bytes (default)
  • kb = kilobytes (1024 bytes)
  • mb = megabytes (1024 kilobytes)
  • gb = gigabytes (1024 megabytes)
  • tb = terabytes (1024 gigabytes)
-v | --version

Display version information.

[No IEC support because we <3 binary and 1+1 still equals 10]

CHANGELOG

License

The MIT License (MIT)

Copyright (c) Hans-Peter Dietz | @h_p_d | h.p.dietz@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

A shell utility to retrieve the disk space consumed by files within a directory

License:MIT License


Languages

Language:Shell 94.4%Language:Makefile 5.6%Language:Forth 0.0%