Setup

To get the most out of nu, it is important to setup your path and env for easy access. There are other ways to view these values and variables, however setting up your nu configuration will make it much easier as these are supported cross-platform.


Configure your path and other environment variables

In order to configure your path in nushell you’ll need to modify your PATH environment variable in your config.nu file. Open your config.nu file and put an entry in it like let-env PATH = "path1;path2;path3" ensuring that you use the proper path separation character, which is different by platform.

Alternately, if you want to change your path temporarily, you can do the same command at the prompt.

If you want to append a folder to your PATH environment variable you can do that too using the append or prepend command like this:

  1. > let-env PATH = ($env.PATH | append "some/other/path")

For more detailed instructions, see the our environment variables documentation hereSetup - 图1 (opens new window)

How to list your environment variables

  1. > $env

Output

  1. ─────────────────────────────────┬────────────────────────────────────────────
  2. ALLUSERSPROFILE C:\ProgramData
  3. CARGO_PKG_AUTHORS The Nu Project Contributors
  4. CARGO_PKG_DESCRIPTION A new type of shell
  5. CARGO_PKG_HOMEPAGE https://www.nushell.sh
  6. CARGO_PKG_LICENSE MIT
  7. CARGO_PKG_LICENSE_FILE
  8. CARGO_PKG_NAME nu
  9. CARGO_PKG_REPOSITORY https://github.com/nushell/nushell
  10. CARGO_PKG_VERSION 0.59.0
  11. CARGO_PKG_VERSION_MAJOR 0

or for a more detailed view, use our new env command.

  1. > env

Output

  1. ────┬─────────────────────────────┬─────────────────────────────┬─────────────────────────────┬──────────────────────────────
  2. # │ name │ type │ value │ raw
  3. ────┼─────────────────────────────┼─────────────────────────────┼─────────────────────────────┼──────────────────────────────
  4. 0 ALLUSERSPROFILE string C:\ProgramData C:\ProgramData
  5. 1 APPDATA string C:\Users\someuser10\AppData C:\Users\someuser10\AppData
  6. \Roaming \Roaming
  7. 2 CARGO string \\?\C:\Users\someuser10\.ru \\?\C:\Users\someuser10\.ru
  8. stup\toolchains\stable-x86_ stup\toolchains\stable-x86_
  9. 64-pc-windows-msvc\bin\carg 64-pc-windows-msvc\bin\carg
  10. o.exe o.exe
  11. 3 CARGO_HOME string C:\Users\someuser10\.cargo C:\Users\someuser10\.cargo
  12. 4 CARGO_MANIFEST_DIR string C:\Users\someuser10\source\ C:\Users\someuser10\source\
  13. repos\forks\nushell repos\forks\nushell
  14. 5 CARGO_PKG_AUTHORS string The Nu Project Contributors The Nu Project Contributors
  15. 6 CARGO_PKG_DESCRIPTION string A new type of shell A new type of shell
  16. 7 CARGO_PKG_HOMEPAGE string https://www.nushell.sh │ https://www.nushell.sh
  17. 8 CARGO_PKG_LICENSE string MIT MIT
  18. 9 CARGO_PKG_LICENSE_FILE string
  19. 10 CARGO_PKG_NAME string nu nu
  20. 11 CARGO_PKG_REPOSITORY string https://github.com/nushell/ │ https://github.com/nushell/

How to get a single environment variable’s value

  1. > $env.APPDATA

or

  1. > env | where name == APPDATA
  1. ───┬─────────┬────────┬─────────────────────────────────────┬─────────────────────────────────────
  2. # │ name │ type │ value │ raw
  3. ───┼─────────┼────────┼─────────────────────────────────────┼─────────────────────────────────────
  4. 0 APPDATA string C:\Users\someuser10\AppData\Roaming C:\Users\someuser10\AppData\Roaming
  5. ───┴─────────┴────────┴─────────────────────────────────────┴─────────────────────────────────────