Operations 7 min read

Master NuShell: Install, Basics, and Powerful Pipelines in Minutes

This guide introduces NuShell, a Rust‑based modern shell that merges Unix pipelines with structured data handling, provides step‑by‑step installation instructions for Linux, macOS, and Windows, and demonstrates quick‑start commands, custom functions, and scripting examples for efficient data processing.

Open Source Tech Hub
Open Source Tech Hub
Open Source Tech Hub
Master NuShell: Install, Basics, and Powerful Pipelines in Minutes

Overview

NuShell is a modern, Rust‑based shell that blends the Unix pipeline philosophy with structured data handling, allowing direct manipulation of JSON, tables, and even database queries without relying on separate tools like awk, grep, or jq.

Official site: https://www.nushell.sh

Installation

The latest version 0.107.0 (released 2025‑09‑02) adds better plugin support and performance improvements. Below are quick installation guides for the major platforms.

Linux

Use Cargo (recommended if Rust is installed) : run cargo install nushell to download and compile the latest release from crates.io.

Pre‑compiled binaries : download the appropriate tar.gz from the GitHub Releases page, extract, and move the nu executable to /usr/local/bin.

Package managers :

Ubuntu/Debian: sudo apt install nushell Fedora: sudo dnf install nushell Arch:

sudo pacman -S nushell

macOS

Homebrew : brew install nushell – the simplest method.

Alternatively use Cargo or download the GitHub binary as on Linux.

Windows

Winget : winget install nushell for user‑level install, or winget install nushell --scope machine for system‑wide.

Cargo or manual .exe download are also supported.

After installation, run nu to start the interactive shell. Beginners should type help to view built‑in help; the whole process is low‑threshold and can be mastered in about five minutes.

Quick Start

NuShell retains the essence of Unix pipelines while adding intelligent syntax. For example, ls now displays results as a tidy table instead of raw text.

D:\dnmp\www\ai\redis-stream> ls
╭────┬───────────────────────┬──────┬─────────┬───────────────╮
│  # │          name          │type │  size   │   modified    │
├────┼───────────────────────┼──────┼─────────┼───────────────┤
│ 0  │ .github                │ dir  │ 4.0 kB │ 5 days ago    │
│ 1  │ .gitignore             │ file │ 598 B  │ 5 days ago    │
│ …  │ …                      │ …    │ …       │ …            │
╰────┴───────────────────────┴──────┴─────────┴───────────────╯

Basic Pipeline Operations

> ls | select name type size | where size > 1KB
╭────┬─────────────────────┬──────┬──────────╮
│  # │        name         │type │  size    │
├────┼─────────────────────┼──────┼──────────┤
│ 0  │ .github             │ dir  │ 4.1 KB  │
│ 1  │ CODE_OF_CONDUCT.md │ file │ 3.4 KB  │
│ …  │ …                   │ …    │ …       │
╰────┴─────────────────────┴──────┴──────────╯

Filter directories: ls | where type == "dir" Sort by file size: ls | sort-by size --reverse Show top 3 largest files: ls | sort-by size --reverse | first 3 | get name These commands still output structured data, which can be further piped, e.g.:

ls | where size > 1mb | get name | str trim | echo $'Files over 1MB:
($in)'

Custom Commands

Define reusable functions just like in a script:

def greet [name: string = "World"] {
    $"Hello, ($name)!"
}

greet      # → Hello, World!

greet Alice # → Hello, Alice!

This is useful for modularizing your toolchain.

Scripting

Create a file myscript.nu:

def main [] {
    let files = ls
    $files | where size > 500kb | get name | each {|it| rm $it }
    print "清理完成!"
}

Run it with nu myscript.nu; the script deletes all files larger than 500 KB, starting execution at the main function and supporting parameters and type checking.

For many more examples, consult the official Cookbook, which covers scenarios from log analysis to API calls.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

data-processingShellcommand-lineScriptingInstallationNushell
Open Source Tech Hub
Written by

Open Source Tech Hub

Sharing cutting-edge internet technologies and practical AI resources.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.