A data-oriented shell

Filesystem Data as Tables

The ls command in Nushell returns a table of files with columns such as name, type, size, and modified timestamp, rather than a simple text listing. This means you can query it directly. For example, you can list directories in the current folder sorted by last modified time (as shown in Figure 3) with

ls | where type == "dir" | sort-by modified | reverse
Figure 3: The ls command filters and sorts only directories by their last modified time, displaying the results in a structured table with color-coded columns for clarity.

System Information as Structured Data

Commands such as ps (process list) and sys (system info) are built into Nushell and return structured data as well. For instance, ps gives you a table of running processes (with columns for PID, name, CPU, memory, etc.). You could find the top memory-consuming process (see Figure 4) with

ps | sort-by mem | last 1
Figure 4: Nushell displays the process using the most memory (in this case, dockerd) with detailed metrics in a structured table format.

Opening and Parsing Structured Files

Nushell's open command is a powerful way to bring data from files (or URLs) into Nushell's pipeline. It auto-detects file types including JSON, CSV, TOML, YAML, XML, Excel, SQLite, and more and parses them into tables or records [2]. For example, the table in Figure 5 is generated with

open stack.yaml
Figure 5: Nushell opens and visualizes the stack.yaml file as a nested table, making it easy to inspect OpenFaaS deployment details such as provider, gateway URL, and function configuration.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • FOSSPicks

    After building a 3D printer last month, Graham's home is now filled with cup holders, phone holders, cable holders, and tiny PLA boats. This month, Graham explores Zrythm, Mumble 1.3, NoteKit, Kirogi, monolith, pastel, Nu Shell, PacVim, Stunt Car Racer Remake, and more!

  • Spider, Spider

    Scrapy is an open source framework written in Python that lets you build your own crawlers with minimal effort for professional results.

  • Advanced Shell Scripting

    Shell scripting is a versatile tool for managing and automating the modern IT infrastructure. This article reaches beyond the basics with some advanced techniques for tackling real-world challenges.

  • Bash vs. Vista PowerShell

    Microsoft’s new PowerShell relies on .NET framework libraries and thus has access to a treasure trove of functions and objects. How does PowerShell measure up to traditional shells like Bash?

  • Tutorial – Shell Scripting

    You do not need to learn low-level programming languages to become a real Linux power user. Shell scripting is all you need.

comments powered by Disqus
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters

Support Our Work

Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.

Learn More

News