Nushell coming from Bash
config env
config nu
let-env Path = ($env.Path | prepend ‘C:\Program Files\Git\usr\bin’)
IO - Files and Folders/Directories
Bash Nu
ls ls
ls <dir> ls <dir>
ls pattern* ls pattern*
ls -la ls --long --all or ls -la
ls -d */ ls | where type == dir
find . -name *.rs ls **/*.rs
find . -name Makefile | xargs vim ls **/Makefile | get name | vim $in
cd <dir> cd <dir>
cd cd home
cd ~ cd ~ home
cd - cd - prev
mkdir <path> mkdir <path>
touch test touch test
> <path> | save --raw <path>
>> <path> | save --raw --append <path>
cat <path> open --raw <path>
open <path> read file as structured data
// Equal
mv <src> <dst>
cp <src> <dst>
cp -r <src> <dst>
rm <path>
rm -t <path> into sys trash
rm -rf <path> rm -r <path>
date -d <date> "<date>" | into datetime -f <format>
sed str replace find and replace pattern
grep <pattern> where $it =~ <substring>
grep <pattern> find <substring>
man <command> help <command>
help commands
help --find <string>
cmd1 && cmd2 cmd1; cmd2
stat $(which git) stat (which git).path use cmd output
echo /tmp/$RANDOM echo $"/tmp/(random integer)"
cargo b --jobs=$(nproc) cargo b $"--jobs=(sys | get cpu | length)"
export echo $env list env vars
FOO=BAR ./bin FOO=BAR ./bin update env temporarily
export FOO=BAR let-env FOO = BAR set envvar for current session
echo $FOO echo $env.FOO
unset FOO hide FOO
echo $PATH echo $env.PATH
export PATH = $PATH:/usr/other/bin let env PATH = ($env.PATH | append /usr/other/bin) update path temporarily
alias s="git status -sb" alias s = git status -sb
type FOO which FOO info about cmd
<update ~/.bashrc> vim $nu.config-path env setup - PATH, alias etc
bash -c <cmd> nu -c <cmd>
bash <file> nu <file>
\ (<cmd>) multiline cmd
pwd $env.PWD current dir