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 binaries or from crates.io. 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).

What's new

Nu as a login shell (jonathandturner)

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]

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

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
───┴──────────────────

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

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

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