https://www.nushell.sh/about.html
help
config --set [env $nu.env]
config --set [path $nu.path]
config | get env | pivot
shells
- list shells
n
p
- next/prev
enter
- create new shell
exit
- kill shell (remove from the ring buffer)
exit --now
- kill all shells immediately and exit
ls -f | where type == Dir
- -f
for printing all available info
ps | where name == node | format "{pid}" | kill -9 $it
sys | get mem | to json | clip
- clip puts stuff to the copy/paste buffer
cargo search shells --limit 10 | lines | parse "{crate_name} = {version} #{description}"
- parsing
Nu allows you to access native shell programs by escaping the program name with ^
.
open Cargo.toml | inc package.version --patch | save
- edit file in place
open bands.txt | lines | split-column ":" Band Album Year | skip 1 | sort-by Year
rg -c Tagged | lines | split-column ":" file line_count | str --to-int line_count | sort-by line_count | reverse
open people.txt | lines | split column "|" first_name last_name job | trim | sort-by first_name
open Cargo.lock | from toml
open Cargo.toml --raw
- work with raw text
fetch https://www.jonathanturner.org/feed.xml
ls | select name size
ls | sort-by name | nth 5
select
- creates a new table which includes only the columns specified
get
- returns the values inside the column specified as a list
open rustfmt.toml | insert next_edition 2021 | save rustfmt2.toml
open Cargo.toml | inc package.version --minor | get package.version
The autoview
command is appended to any pipeline that doesn’t have an output allowing us to see the result.
^ls
- run local cmd, not Nu's equivalent
alias --save e [msg] { echo $msg }
= 1 + 3
= 1 not-in: [1 2 3]
= "foobar" =~ "foo"
ls | where name in: ["one" "two" "three"] && size > 10kb
with-env [FOO BAR] { echo $nu.env.FOO }
FOO=BAR echo $nu.env.FOO
> <path>
| save --raw <path>
- Save string into a file
cat <path>
open --raw <path>
- Display the contents of the given file
Readers should note that this is very outdated now and a lot of it doesn't work anymore.