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

rm for filesystem

Remove files and directories.

Signature

> rm {flags} ...rest

Flags

  • --trash, -t: move to the platform's trash instead of permanently deleting. not used on android and ios
  • --permanent, -p: delete permanently, ignoring the 'always_trash' config option. always enabled on android and ios
  • --recursive, -r: delete subdirectories recursively
  • --force, -f: suppress error when no file
  • --verbose, -v: print names of deleted files
  • --interactive, -i: ask user to confirm action
  • --interactive-once, -I: ask user to confirm action only once

Parameters

  • ...rest: The file paths(s) to remove.

Input/output types:

inputoutput
nothingnothing

Examples

Delete, or move a file to the trash (based on the 'always_trash' config option)

> rm file.txt

Move a file to the trash

> rm --trash file.txt

Delete a file permanently, even if the 'always_trash' config option is true

> rm --permanent file.txt

Delete a file, ignoring 'file not found' errors

> rm --force file.txt

Delete all 0KB files in the current directory

> ls | where size == 0KB and type == file | each { rm $in.name } | null