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
  • Categories

    • Bits
    • Bytes
    • Chart
    • Conversions
    • Core
    • Database
    • Dataframe
    • Dataframe Or Lazyframe
    • Date
    • Debug
    • Default
    • Env
    • Experimental
    • Expression
    • Filesystem
    • Filters
    • Formats
    • Generators
    • Hash
    • History
    • Lazyframe
    • Math
    • Misc
    • Network
    • Path
    • Platform
    • Plugin
    • Prompt
    • Random
    • Removed
    • Shells
    • Strings
    • System
    • Viewers

save for filesystem

Save a file.

Signature

> save {flags} (filename)

Flags

  • --stderr, -e {path}: The filename used to save stderr, only works with -r flag.
  • --raw, -r: Save file as raw binary.
  • --append, -a: Append input to the end of the file.
  • --force, -f: Overwrite the destination.
  • --progress, -p: Enable progress bar.

Parameters

  • filename: The filename to use.

Input/output types:

inputoutput
anynothing

Examples

Save a string to foo.txt in the current directory.

> 'save me' | save foo.txt

Append a string to the end of foo.txt.

> 'append me' | save --append foo.txt

Save a record to foo.json in the current directory.

> { a: 1, b: 2 } | save foo.json

Save a running program's stderr to foo.txt.

> do -i {} | save foo.txt --stderr foo.txt

Save a running program's stderr to separate file.

> do -i {} | save foo.txt --stderr bar.txt

Show the extensions for which the save command will automatically serialize.

> scope commands
    | where name starts-with "to "
    | insert extension { get name | str replace -r "^to " "" | $"*.($in)" }
    | select extension name
    | rename extension command