Nushell 0.5.0

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 happy to announce the 0.5.0 release for Nu. We've got lots of new features, including some long-requested ones, in this release.

Where to get it

Nu 0.5.0 is available as pre-built binariesopen in new window or from crates.ioopen in new window. If you have Rust installed you can install it using cargo +beta install nu (or if you want all the features cargo +beta install nu --all-features).

Nu as a login shell (sophiajt)

One of the key features that landed in 0.5.0 is set of new capabilities that work together to allow you to use Nu as a login shell, completely independent of bash or other hosting shells. For this, we've built in support for querying and updating the environment variables and the path.

To get started, you'll need to first copy the environment you're using into the config. Luckily, we've also made some improvements there:

> config --set [path $nu:path]
> config --set [env $nu:env]

Version 0.7.2 and later (added: Dec 24, 2019) :

> config set [path $nu.path]
> config set [env $nu.env]

Once these values are set, you'll be able to use Nu as your login shell.

New variables

As you saw above, we've added a few new built-in variables. These will let you know what the current values that Nu can see are for your environment, path, and the config itself.

> echo $nu:env
> echo $nu:path
> echo $nu:config

Version 0.7.2 and later:

> echo $nu.env
> echo $nu.path
> echo $nu.config

Adding paths to your PATH

One of the first things you'll notice is that the new $nu:path is structured. If you run the echo above, you might see something like this:

> echo $nu:path
━━━┯━━━━━━━━━━━━━━━━━━
 # │ <value>
───┼──────────────────
 0 /usr/local/sbin
 1 /usr/local/bin
 2 /usr/sbin
 3 /usr/bin
 4 /sbin
 5 /bin
 6 /usr/games
 7 /usr/local/games
 8 /snap/bin
━━━┷━━━━━━━━━━━━━━━━━━

Version 0.7.2 and later:

> echo $nu.path
━━━┯━━━━━━━━━━━━━━━━━━
 # │ <value>
───┼──────────────────
 0 /usr/local/sbin
 1 /usr/local/bin
 2 /usr/sbin
 3 /usr/bin
 4 /sbin
 5 /bin
 6 /usr/games
 7 /usr/local/games
 8 /snap/bin
━━━┷━━━━━━━━━━━━━━━━━━

We've added two new commands: prepend for adding items to the start of a table and append for adding items to the end of a table. With these commands, we can now query out the path, update it, and save it back.

> echo $nu:path | prepend "/my/new/directory" | config --set_into path

Version 0.7.2 and later:

> echo $nu.path | prepend "/my/new/directory" | config set_into path

Adding variables to your environment

You can use a similar set of steps to add new variables, or change existing variables, in your environment.

> echo $nu:env | insert GREETING hello_world | config --set_into env

Version 0.7.2 and later:

> echo $nu.env | insert GREETING hello_world | config set_into env

Note: the previous add command of previous releases has been renamed insert to remove confusion with mathematical functions.

On-going improvements

We're continuing to improve the commands we currently ship as part of Nu. Here are a few you might find helpful:

Substrings (Flare576)

The str command now supports being able to retrieve a substring from the strings given, so you could return, for example, the first 5 characters and stop after that.

> ls | get name
━━━━┯━━━━━━━━━━━━━━━━━━━━
 #  │ <value>
────┼────────────────────
  0 target
  1 CODE_OF_CONDUCT.md
  2 .cargo
  3 src
  4 features.toml
  5 rustfmt.toml
> ls | get name | str --substring "0,3"
━━━━┯━━━━━━━━━
 #  │ <value>
────┼─────────
  0 tar
  1 COD
  2 .ca
  3 src
  4 fea
  5 rus

Recycling (jdvr)

Ever wish you could rm things, but not forever? You can now tell rm to send items to your platform's recycle bin rather than deleting them forever. As with our other commands, this works across all the platforms that Nu supports.

> rm myfile.txt --trash

Parameter descriptions (sophiajt)

We're also continuing to improve the built-in help system. New in this release are descriptions for the flags and parameters that the command uses. For example, here's a look at what the help for rm now looks like:

> help rm
Remove a file

Usage:
  > rm <path> {flags}

parameters:
  <path> the file path to remove

flags:
  --trash: use the recycle bin on the platform instead of permanently deleting
  --recursive: delete subdirectories recursively

New commands

In addition to the new append and prepend we mentioned earlier, we've added a few new commands to Nu.

Average (notryanb)

Growing our set of mathematics functions for working with numbers, we now have an average command which will take the average of values given to it.

> ls | get size | average

Read (sophiajt)

We've also introduced a new command to load in strings as tables. This new read command will take a pattern that describes the columns, their names, and where they are in each row of the string.

> open .editorconfig
root = true

[*]
indent_style = space
indent_size = 4
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = false
end_of_line = lf
> open .editorconfig | read "{variable} = {value}"
━━━┯━━━━━━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━
 # │ variable                 │ value
───┼──────────────────────────┼───────
 0 root true
 1 indent_style space
 2 indent_size 4
 3 charset utf-8
 4 trim_trailing_whitespace true
 5 insert_final_newline false
 6 end_of_line lf

Bugfixes (sophiajt, JesterOrNot, thegedge, andrasio, wycats, notryanb, Detegr, t-hart)

As always, we've had lots of bugfixes. A huge "thank you!" to folks who reported issues, fixed issues, and just generally shared their experience with the shell. It's much appreciated and helps to continue making Nu that much better.

Survey

If you haven't already taken it, we'd love to hear your feedback in a quick (roughly 3 question) surveyopen in new window.

Looking forward

There are a bunch of areas we're currently working on to make Nu more stable and feature complete. Until this work is finished, please consider Nu to be somewhere in the pre-alpha to alpha quality level.

That said, we're excited to merge this work and continue to take steps towards a more full-featured shell. Soon to be coming will be Nu working on stable Rust(!!), some improvements in the Nu internal engine which will make it possible to have better streaming and cleaner commands, and features like aliases.