Home Explore Blog CI



nushell

1st chunk of `blog/2021-11-16-nushell_0_40.md`
9bbea7a4b58517c94e82b1af2a1aa2fc5d4647e3b64c07b10000000100001351
---
title: Nushell 0.40
author: The Nu Authors
author_site: https://twitter.com/nu_shell
author_image: https://www.nushell.sh/blog/images/nu_logo.png
excerpt: Today, we're releasing 0.40 of Nu. This release is includes better table imports and much smaller release size.
---

# Nushell 0.40

Nushell, or Nu for short, is a new shell that takes a modern, structured approach to your commandline. It works seamlessly with the data from your filesystem, operating system, and a growing number of file formats to make it easy to build powerful commandline pipelines.

Today, we're releasing 0.40 of Nu. This release is includes better table imports and much smaller release size.

<!-- more -->

# Where to get it

Nu 0.40 is available as [pre-built binaries](https://github.com/nushell/nushell/releases/tag/0.40.0) or from [crates.io](https://crates.io/crates/nu). If you have Rust installed you can install it using `cargo install nu`.

If you want all the goodies, you can install `cargo install nu --features=extra`.

As part of this release, we also publish a set of plugins you can install and use with Nu. To install, use `cargo install nu_plugin_<plugin name>`.

# What's New

## Detecting columns (sophiajt)

Nushell now supports a new command: `detect columns`. This command is intended as an easy way to handle tabular data that's written as text. Commands like `ps`, `ls -l`, `netstat`, `df`, and others commonly output their output as text. With `detect columns`, you can run the external command, and convert them into Nushell's tabular data format.

Let's look at an example:

```
> df
Filesystem     1K-blocks      Used Available Use% Mounted on
udev             8108824         0   8108824   0% /dev
tmpfs            1631284      2068   1629216   1% /run
/dev/nvme1n1p2 490691512 346066860 119629172  75% /
tmpfs            8156408    251332   7905076   4% /dev/shm
tmpfs               5120         4      5116   1% /run/lock
tmpfs            8156408         0   8156408   0% /sys/fs/cgroup
/dev/nvme0n1p1    508932    211684    297248  42% /boot/efi
tmpfs            1631280       128   1631152   1% /run/user/1000
/dev/nvme0n1p2 238810780 136867812  89742316  61% /media/sophiajt/Data
```

The `df` command comes with most Unix-based systems and prints out a table of data for each of the devices on the system. Let's turn this into a table we can work with in Nushell:

```
> df | detect columns
───┬────────────────┬───────────┬───────────┬───────────┬──────┬────────────────┬────────────────
 # │   Filesystem   │ 1K-blocks │   Used    │ Available │ Use% │    Mounted     │       on
───┼────────────────┼───────────┼───────────┼───────────┼──────┼────────────────┼────────────────
 0 │ udev           │ 8108824   │ 0         │ 8108824   │ 0%   │ /dev           │
 1 │ tmpfs          │ 1631284   │ 2068      │ 1629216   │ 1%   │ /run           │
 2 │ /dev/nvme1n1p2 │ 490691512 │ 346067044 │ 119628988 │ 75%  │ /              │
 3 │ tmpfs          │ 8156408   │ 251332    │ 7905076   │ 4%   │ /dev/shm       │
 4 │ tmpfs          │ 5120      │ 4         │ 5116      │ 1%   │ /run/lock      │ /run/lock
 5 │ tmpfs          │ 8156408   │ 0         │ 8156408   │ 0%   │ /sys/fs/cgroup │ /sys/fs/cgroup
 6 │ /dev/nvme0n1p1 │ 508932    │ 211684    │ 297248    │ 42%  │ /boot/efi      │ /boot/efi
 7 │ tmpfs          │ 1631280   │ 128       │ 1631152   │ 1%   │ /run/user/1000 │ /run/user/1000
 8 │ /dev/nvme0n1p2 │ 238810780 │ 136867812 │ 89742316  │ 61%  │ /media/st/Data │ /media/st/Data
───┴────────────────┴───────────┴───────────┴───────────┴──────┴────────────────┴────────────────
```

Ahh, that's close to what we want in just one step. Let's go ahead and clean this up a little. First, let's drop that last column. "Mounted on" being two words confused the importer, but all the data is there, we just need to drop the last column.

```
> df | detect columns | drop column
───┬────────────────┬───────────┬───────────┬───────────┬──────┬────────────────
 # │   Filesystem   │ 1K-blocks │   Used    │ Available │ Use% │    Mounted

Title: Nushell 0.40 Release - Featuring 'detect columns' Command
Summary
Nushell 0.40 is released with improvements including better table imports and a smaller release size. A key feature is the new 'detect columns' command, designed to easily convert text-based tabular data from external commands like 'df', 'ps', and 'ls -l' into Nushell's structured table format for easier manipulation.