Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
GitHub
  • Language Reference Guide
    • Readme
    • Types in the Nu Language
      • Basic Types
        • Any
        • Boolean
        • Integer
        • Float
        • Filesize
        • Duration
        • Datetime
        • Range
        • String
        • Record
        • List
        • Table
        • Closure
        • Nothing
        • Binary
        • Glob
        • Cell-Path
      • Other Data Types

        • Types that cannot be used to declare variables
          • Path
        • Types which are not declarable
          • Error
          • CustomValue
          • Block
      • Type signatures
      • Commands that interact with types
    • Operators
    • Flow control
      • if/else
      • loop
      • while
      • match
      • try/catch
      • break
      • return
      • continue
    • Filters
      • each and par-each
      • Filters to select subsets of data
      • where and filter
      • Understanding the difference between get and select
    • Custom Commands
    • Declarations
    • Variable Scope
    • Strings and Text Formatting
    • Helpers and debugging commands
    • Pipelines
    • MIME Types for Nushell

Filesize

Description:Specialized numeric type to represent the size of files or a number of bytes
Annotation:filesize
Literal Syntax:A numeric value followed by a filesize unit (below). E.g., 5GB, 1024B
Casts:into filesize
See also:Types of Data - File sizes

The filesize literal and display representations support both:

  • Metric prefixes with a base of 1000
  • Binary-compatible kibibytes, mebibytes, etc. with a base of 1024

The full list of filesize units is:

Decimal (factor of 1000)Binary (factor of 1024)
B: bytesB: bytes
kB: kilobytesKiB: kibibytes
MB: megabytesMiB: mebibytes
GB: gigabytesGiB: gibibytes
TB: terabytesTiB: tebibytes
PB: petabytesPiB: pebibytes
EB: exabytesEiB: exbibytes

Tips

File size units are case-insensitive. E.g., 1KiB, 1kib, and 1Kib are all equivalent.

Common commands that can work with filesizes

  • ls
  • du
  • sys

Note: The where command and other filters can use filesize in comparison expressions.

Common operators that can be used with filesize

  • ==, !=
  • +, -
  • <, <=, >, >=
Edit this page on GitHub
Contributors: NotTheDr01ds, fdncred
Prev
Float
Next
Duration