0% found this document useful (0 votes)
57 views6 pages

Nushell Learning PDF

The document outlines a beginner-friendly learning path for Nushell, a modern shell written in Rust. It covers installation, basic commands, pipelines, scripting, and additional resources for further learning. The goal is to help users build a solid foundation in Nushell and utilize its structured data capabilities for efficient workflows.

Uploaded by

topwin34
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views6 pages

Nushell Learning PDF

The document outlines a beginner-friendly learning path for Nushell, a modern shell written in Rust. It covers installation, basic commands, pipelines, scripting, and additional resources for further learning. The goal is to help users build a solid foundation in Nushell and utilize its structured data capabilities for efficient workflows.

Uploaded by

topwin34
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Nushell Learning Path for Beginners

Grok
May 2025

Abstract
This learning path introduces Nushell, a modern shell written in Rust, designed for
beginners. It covers installation, basic commands, pipelines, scripting, and resources for
further learning. Follow the steps to build a solid foundation in Nushell and leverage its
structured data approach for efficient shell workflows.
Nushell Learning Path for Beginners Grok

Contents
1 Introduction to Nushell 3
1.1 Why Learn Nushell? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Learning Objectives . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Installing Nushell 3
2.1 Installation Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2.2 Verify Installation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

3 Basic Commands and Navigation 4


3.1 Getting Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.2 Filesystem Navigation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.3 Practice Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

4 Working with Pipelines and Structured Data 4


4.1 Understanding Pipelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.2 Common Pipeline Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.3 Practice Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5

5 Introduction to Scripting 5
5.1 Creating a Script . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.2 Key Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
5.3 Practice Task . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6

6 Further Resources 6

7 Conclusion 6

Page 2 of 6
Nushell Learning Path for Beginners Grok

1 Introduction to Nushell
Nushell, or “Nu,” is a cross-platform shell written in Rust, combining the Unix philosophy of
pipelines with structured data handling inspired by PowerShell and functional programming.
Unlike traditional shells like Bash, Nushell treats data as structured tables, lists, or records,
making it easier to manipulate and query. This learning path is designed for beginners to master
Nushell’s basics in a structured way.

1.1 Why Learn Nushell?


• Cross-Platform: Works on Linux, macOS, Windows, and BSD.
• Structured Data: Handle JSON, YAML, SQLite, and more without parsing strings.
• Error Handling: Catch bugs at parse time with clear error messages.
• Modern Features: Supports functional programming, immutable variables, and plugins.

1.2 Learning Objectives


By the end of this path, you will:
• Install and configure Nushell.
• Navigate the filesystem and use basic commands.
• Work with pipelines and structured data.
• Write simple scripts.
• Know where to find help and further resources.

2 Installing Nushell
Before diving in, install Nushell on your system. Nushell requires Rust 1.66.1 or later. Below
are beginner-friendly instructions for common platforms.

2.1 Installation Methods


• Homebrew (macOS/Linux):
1 brew install nushell

• Windows (via winget):


1 winget install nushell

• Linux (via package manager, e.g., Ubuntu):


1 sudo apt update
2 sudo apt install nushell

• From Source (Advanced): Clone the repository and build with Cargo (see Nushell
Book).

Page 3 of 6
Nushell Learning Path for Beginners Grok

2.2 Verify Installation


Launch Nushell by typing:
1 nu

You should see the Nushell prompt. To exit, type exit.

3 Basic Commands and Navigation


Start with Nushell’s core commands to navigate and explore your system.

3.1 Getting Help


Nushell has built-in help:
1 help commands

Search for a specific command:


1 help ls

3.2 Filesystem Navigation


• List files: ls (shows a table with name, type, size, modified).
1 ls

• Change directory: cd or just the path.


1 cd ~/ Documents
2 # or
3 ~/ Documents

• Go up a directory: Use .. for parent, .... for grandparent.


1 cd ..

• Create directory: mkdir (no -p needed, repeats are safe).


1 mkdir my_folder

3.3 Practice Task


1. Open Nushell.
2. List files in your home directory.
3. Navigate to a subdirectory.
4. Create a folder named nu_test.

4 Working with Pipelines and Structured Data


Nushell’s strength is its ability to handle structured data through pipelines.

Page 4 of 6
Nushell Learning Path for Beginners Grok

4.1 Understanding Pipelines


Pipelines use the | operator to pass data between commands. Unlike Bash, Nushell passes
structured data (e.g., tables), not just text.
Example: List files larger than 1 KB:
1 ls | where size > 1 kb

4.2 Common Pipeline Commands


• where: Filter data based on conditions.
1 ls | where type == file

• get: Select columns from a table.


1 sys | get host . sessions . name

• each: Apply a command to each row.


1 ls | get name | each { | it | echo $it }

4.3 Practice Task


1. List all files in a directory.
2. Filter to show only files (not directories).
3. Select only the name column.

5 Introduction to Scripting
Nushell allows you to write scripts using its programming language features.

5.1 Creating a Script


Create a file, e.g., hello.nu, with:
1 def say_hello [ name : string ] {
2 echo " Hello , $name ! "
3 }
4 say_hello " World "

Run it:
1 source hello . nu

5.2 Key Concepts


• Custom Commands: Use def to define functions.
• Variables: Use let for immutable variables.
1 let x = 42

• Shadowing: Redefine variables with the same name.

Page 5 of 6
Nushell Learning Path for Beginners Grok

1 let x = 10
2 let x = $x + 1

5.3 Practice Task


Write a script that:
1. Defines a command to list files with a custom message.
2. Runs the command.
Example:
1 def list_files [] {
2 echo " Listing files : "
3 ls
4 }
5 list_files

6 Further Resources
Continue learning with these resources:
• Nushell Book: www.nushell.sh/book for official documentation.
• Discord: Join the Nushell community on Discord for support.
• Tutorial Command: Run tutor in Nushell for interactive lessons.
• Cookbook: Explore practical examples in the Nushell Cookbook.

7 Conclusion
This learning path provides a beginner-friendly introduction to Nushell. Practice the tasks,
explore the documentation, and engage with the community to deepen your skills. Nushell’s
structured data approach will make your shell workflows more powerful and reliable.

Page 6 of 6

You might also like