命令索引
若要查看所有 Nushell 命令, 可以执行 help commands
。
译注:本页内容由于是从源码生成的暂不支持国际化,大家还是先看英文版的凑合下吧。
Command | Description |
---|---|
alias | Alias a command (with optional flags) to a new name. |
all | Test if every element of the input fulfills a predicate expression. |
ansi | Output ANSI codes to change color and style of text. |
ansi gradient | Add a color gradient (using ANSI color codes) to the given string. |
ansi link | Add a link (using OSC 8 escape sequence) to the given string. |
ansi strip | Strip ANSI escape sequences from a string. |
any | Tests if any element of the input fulfills a predicate expression. |
append | Append any number of rows to a table. |
ast | Print the abstract syntax tree (ast) for a pipeline. |
bits | Various commands for working with bits. |
bits and | Performs bitwise and for integers. |
bits not | Performs logical negation on each bit. |
bits or | Performs bitwise or for integers. |
bits rol | Bitwise rotate left for integers. |
bits ror | Bitwise rotate right for integers. |
bits shl | Bitwise shift left for integers. |
bits shr | Bitwise shift right for integers. |
bits xor | Performs bitwise xor for integers. |
break | Break a loop. |
bytes | Various commands for working with byte data. |
bytes add | Add specified bytes to the input. |
bytes at | Get bytes defined by a range |
bytes build | Create bytes from the arguments. |
bytes collect | Concatenate multiple binary into a single binary, with an optional separator between each. |
bytes ends-with | Check if bytes ends with a pattern. |
bytes index-of | Returns start index of first occurrence of pattern in bytes, or -1 if no match. |
bytes length | Output the length of any bytes in the pipeline. |
bytes remove | Remove bytes. |
bytes replace | Find and replace binary. |
bytes reverse | Reverse the bytes in the pipeline. |
bytes starts-with | Check if bytes starts with a pattern. |
cal | Display a calendar. |
cd | Change directory. |
char | Output special characters (e.g., 'newline'). |
clear | Clear the terminal. |
collect | Collect the stream and pass it to a block. |
columns | Given a record or table, produce a list of its columns' names. |
commandline | View or modify the current command line input buffer. |
compact | Creates a table with non-empty rows. |
complete | Capture the outputs and exit code from an external piped in command in a nushell table. |
config | Edit nushell configuration files. |
config env | Edit nu environment configurations. |
config nu | Edit nu configurations. |
config reset | Reset nushell environment configurations to default, and saves old config files in the config location as oldconfig.nu and oldenv.nu. |
const | Create a parse-time constant. |
continue | Continue a loop from the next iteration. |
cp | Copy files. |
date | Date-related commands. |
date format | Format a given date using a format string. |
date humanize | Print a 'humanized' format for the date, relative to now. |
date list-timezone | List supported time zones. |
date now | Get the current date. |
date to-record | Convert the date into a record. |
date to-table | Convert the date into a structured table. |
date to-timezone | Convert a date to a given time zone. |
debug | Debug print the value(s) piped in. |
decode | Decode bytes into a string. |
decode base64 | Base64 decode a value. |
decode hex | Hex decode a value. |
def | Define a custom command. |
def-env | Define a custom command, which participates in the caller environment. |
default | Sets a default row's column if missing. |
describe | Describe the type and structure of the value(s) piped in. |
detect columns | Attempt to automatically split text into multiple columns. |
dfr agg | Performs a series of aggregations from a group-by. |
dfr agg-groups | creates an agg_groups expression |
dfr all-false | Returns true if all values are false. |
dfr all-true | Returns true if all values are true. |
dfr append | Appends a new dataframe. |
dfr arg-max | Return index for max value in series. |
dfr arg-min | Return index for min value in series. |
dfr arg-sort | Returns indexes for a sorted series. |
dfr arg-true | Returns indexes where values are true. |
dfr arg-unique | Returns indexes for unique values. |
dfr arg-where | Creates an expression that returns the arguments where expression is true. |
dfr as | Creates an alias expression. |
dfr as-date | Converts string to date. |
dfr as-datetime | Converts string to datetime. |
dfr cache | Caches operations in a new LazyFrame |
dfr col | Creates a named column expression. |
dfr collect | Collect lazy dataframe into eager dataframe. |
dfr columns | Show dataframe columns. |
dfr concat-str | Creates a concat string expression. |
dfr concatenate | Concatenates strings with other array. |
dfr contains | Checks if a pattern is contained in a string. |
dfr count | creates a count expression |
dfr count-null | Counts null values. |
dfr cumulative | Cumulative calculation for a series. |
dfr drop | Creates a new dataframe by dropping the selected columns. |
dfr drop-duplicates | Drops duplicate values in dataframe. |
dfr drop-nulls | Drops null values in dataframe. |
dfr dtypes | Show dataframe data types. |
dfr dummies | Creates a new dataframe with dummy variables. |
dfr explode | creates an explode expression |
dfr expr-not | creates a not expression |
dfr fetch | collects the lazyframe to the selected rows. |
dfr fill-nan | Replaces NaN values with the given expression. |
dfr fill-null | Replaces NULL values with the given expression. |
dfr filter | Filter dataframe based in expression. |
dfr filter-with | Filters dataframe using a mask or expression as reference. |
dfr first | Show only the first number of rows. creates a first expression |
dfr flatten | creates a flatten expression |
dfr get | Creates dataframe with the selected columns. |
dfr get-day | Gets day from date. |
dfr get-hour | Gets hour from date. |
dfr get-minute | Gets minute from date. |
dfr get-month | Gets month from date. |
dfr get-nanosecond | Gets nanosecond from date. |
dfr get-ordinal | Gets ordinal from date. |
dfr get-second | Gets second from date. |
dfr get-week | Gets week from date. |
dfr get-weekday | Gets weekday from date. |
dfr get-year | Gets year from date. |
dfr group-by | Creates a group-by object that can be used for other aggregations. |
dfr implode | Aggregates a group to a Series |
dfr into-df | Converts a list, table or record into a dataframe. |
dfr into-lazy | Converts a dataframe into a lazy dataframe. |
dfr into-nu | Converts a section of the dataframe into nushell Table. Convert expression into a nu value for access and exploration. |
dfr is-duplicated | Creates mask indicating duplicated values. |
dfr is-in | Checks if elements from a series are contained in right series. Creates an is-in expression. |
dfr is-not-null | Creates mask where value is not null. creates a is not null expression |
dfr is-null | Creates mask where value is null. creates a is null expression |
dfr is-unique | Creates mask indicating unique values. |
dfr join | Joins a lazy frame with other lazy frame. |
dfr last | Creates new dataframe with tail rows or creates a last expression. creates a last expression |
dfr lit | Creates a literal expression. |
dfr lowercase | Lowercase the strings in the column. |
dfr ls | Lists stored dataframes. |
dfr max | Creates a max expression Aggregates columns to their max value |
dfr mean | Creates a mean expression for an aggregation Aggregates columns to their mean value |
dfr median | Creates a median expression for an aggregation Aggregates columns to their median value |
dfr melt | Unpivot a DataFrame from wide to long format. |
dfr min | Creates a min expression Aggregates columns to their min value |
dfr n-unique | Counts unique values. creates a n-unique expression |
dfr not | Inverts boolean mask. |
dfr open | Opens CSV, JSON, arrow, or parquet file to create dataframe. |
dfr otherwise | completes a when expression. |
dfr quantile | Aggregates the columns to the selected quantile. Aggregates the columns to the selected quantile. |
dfr query | Query dataframe using SQL. Note: The dataframe is always named 'df' in your query's from clause. |
dfr rename | Rename a dataframe column. |
dfr replace | Replace the leftmost (sub)string by a regex pattern. |
dfr replace-all | Replace all (sub)strings by a regex pattern. |
dfr reverse | Reverses the LazyFrame |
dfr rolling | Rolling calculation for a series. |
dfr sample | Create sample dataframe. |
dfr select | Selects columns from lazyframe. |
dfr set | Sets value where given mask is true. |
dfr set-with-idx | Sets value in the given index. |
dfr shape | Shows column and row size for a dataframe. |
dfr shift | Shifts the values by a given period. |
dfr slice | Creates new dataframe from a slice of rows. |
dfr sort-by | sorts a lazy dataframe based on expression(s). |
dfr std | Creates a std expression for an aggregation Aggregates columns to their std value |
dfr str-lengths | Get lengths of all strings. |
dfr str-slice | Slices the string from the start position until the selected length. |
dfr strftime | Formats date based on string rule. |
dfr sum | Creates a sum expression for an aggregation Aggregates columns to their sum value |
dfr summary | For a dataframe, produces descriptive statistics (summary statistics) for its numeric columns. |
dfr take | Creates new dataframe using the given indices. |
dfr to-arrow | Saves dataframe to arrow file. |
dfr to-csv | Saves dataframe to CSV file. |
dfr to-parquet | Saves dataframe to parquet file. |
dfr unique | Returns unique values from a dataframe. |
dfr uppercase | Uppercase the strings in the column. |
dfr value-counts | Returns a dataframe with the counts for unique values in series. |
dfr var | Create a var expression for an aggregation Aggregates columns to their var value |
dfr when | Creates and modifies a when expression. |
dfr with-column | Adds a series to the dataframe. |
do | Run a closure, providing it with the pipeline input. |
drop | Remove items/rows from the end of the input list/table. Counterpart of `skip`. Opposite of `last`. |
drop column | Remove N columns at the right-hand end of the input table. To remove columns by name, use `reject`. |
drop nth | Drop the selected rows. |
du | Find disk usage sizes of specified items. |
each | Run a closure on each row of the input list, creating a new list with the results. |
each while | Run a block on each row of the input list until a null is found, then create a new list with the results. |
echo | Returns its arguments, ignoring the piped-in value. |
encode | Encode a string into bytes. |
encode base64 | Encode a string or binary value using Base64. |
encode hex | Encode a binary value using hex. |
enter | Enters a new shell at the given path. |
enumerate | Enumerate the elements in a stream. |
error make | Create an error. |
every | Show (or skip) every n-th row, starting from the first one. |
exec | Execute a command, replacing the current process. |
exit | Exit a Nu shell or exit Nu entirely. |
explain | Explain closure contents. |
explore | Explore acts as a table pager, just like `less` does for text. |
export | Export definitions or environment variables from a module. |
export alias | Alias a command (with optional flags) to a new name and export it from a module. |
export def | Define a custom command and export it from a module. |
export def-env | Define a custom command that participates in the environment and export it from a module. |
export extern | Define an extern and export it from a module. |
export module | Export a custom module from a module. |
export use | Use definitions from a module and export them from this module. |
export-env | Run a block and preserve its environment in a current scope. |
extern | Define a signature for an external command. |
fill | Fill and Align. |
filter | Filter values based on a predicate closure. |
find | Searches terms in the input. |
first | Return only the first several rows of the input. Counterpart of `last`. Opposite of `skip`. |
flatten | Flatten the table. |
fmt | Format a number. |
for | Loop over a range. |
format | Format columns into a string using a simple pattern. |
format filesize | Converts a column of filesizes to some specified format. |
from | Parse a string or binary data into structured data. |
from csv | Parse text as .csv and create table. |
from eml | Parse text as .eml and create record. |
from ics | Parse text as .ics and create table. |
from ini | Parse text as .ini and create table. |
from json | Convert from json to structured data. |
from nuon | Convert from nuon to structured data. |
from ods | Parse OpenDocument Spreadsheet(.ods) data and create table. |
from ssv | Parse text as space-separated values and create a table. The default minimum number of spaces counted as a separator is 2. |
from toml | Parse text as .toml and create record. |
from tsv | Parse text as .tsv and create table. |
from url | Parse url-encoded string as a record. |
from vcf | Parse text as .vcf and create table. |
from xlsx | Parse binary Excel(.xlsx) data and create table. |
from xml | Parse text as .xml and create record. |
from yaml | Parse text as .yaml/.yml and create table. |
from yml | Parse text as .yaml/.yml and create table. |
g | Switch to a given shell, or list all shells if no given shell number. |
get | Extract data using a cell path. |
glob | Creates a list of files and/or folders based on the glob pattern provided. |
grid | Renders the output to a textual terminal grid. |
group | Groups input into groups of `group_size`. |
group-by | Splits a list or table into groups, and returns a record containing those groups. |
gstat | Get the git status of a repo |
hash | Apply hash function. |
hash base64 | Deprecated command. |
hash md5 | Hash a value using the md5 hash algorithm |
hash sha256 | Hash a value using the sha256 hash algorithm |
headers | Use the first row of the table as column names. |
help | Display help information about different parts of Nushell. |
help aliases | Show help on nushell aliases. |
help commands | Show help on nushell commands. |
help externs | Show help on nushell externs. |
help modules | Show help on nushell modules. |
help operators | Show help on nushell operators. |
hide | Hide definitions in the current scope. |
hide-env | Hide environment variables in the current scope. |
histogram | Creates a new table with a histogram based on the column name passed in. |
history | Get the command history. |
history session | Get the command history session. |
http | Various commands for working with http methods. |
http delete | Delete the specified resource. |
http get | Fetch the contents from a URL. |
http head | Get the headers from a URL. |
http patch | Patch a body to a URL. |
http post | Post a body to a URL. |
http put | Put a body to a URL. |
if | Conditionally run a block. |
ignore | Ignore the output of the previous command in the pipeline. |
inc | Increment a value or version. Optionally use the column of a table. |
input | Get input from the user. |
input list | Interactive list selection. |
insert | Insert a new column, using an expression or closure to create each row's values. |
inspect | Inspect pipeline results while running a pipeline. |
into | Commands to convert data from one type to another. |
into binary | Convert value to a binary primitive. |
into bool | Convert value to boolean. |
into datetime | Convert text or timestamp into a datetime. |
into decimal | Convert text into a decimal. |
into duration | Convert value to duration. |
into filesize | Convert value to filesize. |
into int | Convert value to integer. |
into record | Convert value to record. |
into sqlite | Convert table into a SQLite database. |
into string | Convert value to string. |
is-admin | Check if nushell is running with administrator or root privileges. |
is-empty | Check for empty values. |
items | Given a record, iterate on each pair of column name and associated value. |
join | Join two tables |
keybindings | Keybindings related commands. |
keybindings default | List default keybindings. |
keybindings list | List available options that can be used to create keybindings. |
keybindings listen | Get input from the user. |
kill | Kill a process using the process id. |
last | Return only the last several rows of the input. Counterpart of `first`. Opposite of `drop`. |
length | Count the number of elements in the input. |
let | Create a variable and give it a value. |
let-env | Create an environment variable and give it a value. |
lines | Converts input to lines. |
load-env | Loads an environment update from a record. |
loop | Run a block in a loop. |
ls | List the filenames, sizes, and modification times of items in a directory. |
match | Conditionally run a block on a matched value. |
math | Use mathematical functions as aggregate functions on a list of numbers or tables. |
math abs | Returns the absolute value of a number. |
math arccos | Returns the arccosine of the number. |
math arccosh | Returns the inverse of the hyperbolic cosine function. |
math arcsin | Returns the arcsine of the number. |
math arcsinh | Returns the inverse of the hyperbolic sine function. |
math arctan | Returns the arctangent of the number. |
math arctanh | Returns the inverse of the hyperbolic tangent function. |
math avg | Returns the average of a list of numbers. |
math ceil | Returns the ceil of a number (smallest integer greater than or equal to that number). |
math cos | Returns the cosine of the number. |
math cosh | Returns the hyperbolic cosine of the number. |
math e | Returns the mathematical constant e (exp(1)/'1 | math exp'). |
math eval | Deprecated command. |
math exp | Returns e raised to the power of x. |
math floor | Returns the floor of a number (largest integer less than or equal to that number). |
math ln | Returns the natural logarithm. Base: (math e). |
math log | Returns the logarithm for an arbitrary base. |
math max | Returns the maximum of a list of numbers, or of columns in a table. |
math median | Computes the median of a list of numbers. |
math min | Finds the minimum within a list of numbers or tables. |
math mode | Returns the most frequent element(s) from a list of numbers or tables. |
math pi | Returns the mathematical constant π. |
math product | Returns the product of a list of numbers or the products of each column of a table. |
math round | Returns the input number rounded to the specified precision. |
math sin | Returns the sine of the number. |
math sinh | Returns the hyperbolic sine of the number. |
math sqrt | Returns the square root of the input number. |
math stddev | Returns the standard deviation of a list of numbers, or of each column in a table. |
math sum | Returns the sum of a list of numbers or of each column in a table. |
math tan | Returns the tangent of the number. |
math tanh | Returns the hyperbolic tangent of the number. |
math tau | Returns the mathematical constant τ. |
math variance | Returns the variance of a list of numbers or of each column in a table. |
merge | Merge the input with a record or table, overwriting values in matching columns. |
metadata | Get the metadata for items in the stream. |
mkdir | Make directories, creates intermediary directories as required. |
module | Define a custom module. |
move | Move columns before or after other columns. |
mut | Create a mutable variable and give it a value. |
mv | Move files or directories. |
n | Switch to the next shell. |
nu-check | Validate and parse input content. |
nu-highlight | Syntax highlight the input string. |
open | Load a file into a cell, converting to table if possible (avoid by appending '--raw'). |
overlay | Commands for manipulating overlays. |
overlay hide | Hide an active overlay. |
overlay list | List all active overlays. |
overlay new | Create an empty overlay. |
overlay use | Use definitions from a module as an overlay. |
p | Switch to the previous shell. |
par-each | Run a closure on each row of the input list in parallel, creating a new list with the results. |
parse | Parse columns from string data using a simple pattern. |
path | Explore and manipulate paths. |
path basename | Get the final component of a path. |
path dirname | Get the parent directory of a path. |
path exists | Check whether a path exists. |
path expand | Try to expand a path to its absolute form. |
path join | Join a structured path or a list of path parts. |
path parse | Convert a path into structured data. |
path relative-to | Express a path as relative to another path. |
path split | Split a path into a list based on the system's path separator. |
path type | Get the type of the object a path refers to (e.g., file, dir, symlink). |
port | Get a free port from system. |
prepend | Prepend any number of rows to a table. |
print | Print the given values to stdout. |
profile | Profile each pipeline element in a closure. |
ps | View information about system processes. |
query | Show all the query commands |
query db | Query a database using SQL. |
query json | execute json query on json file (open --raw <file> | query json 'query string') |
query web | execute selector query on html/web |
query xml | execute xpath query on xml |
random | Generate a random value. |
random bool | Generate a random boolean value. |
random chars | Generate random chars. |
random decimal | Generate a random decimal within a range [min..max]. |
random dice | Generate a random dice roll. |
random integer | Generate a random integer [min..max]. |
random uuid | Generate a random uuid4 string. |
range | Return only the selected rows. |
reduce | Aggregate a list to a single value using an accumulator closure. |
register | Register a plugin. |
registry query | Query the Windows registry. |
reject | Remove the given columns or rows from the table. Opposite of `select`. |
rename | Creates a new table with columns renamed. |
return | Return early from a function. |
reverse | Reverses the input list or table. |
rm | Remove files and directories. |
roll | Rolling commands for tables. |
roll down | Roll table rows down. |
roll left | Roll record or table columns left. |
roll right | Roll table columns right. |
roll up | Roll table rows up. |
rotate | Rotates a table or record clockwise (default) or counter-clockwise (use --ccw flag). |
run-external | Runs external command. |
save | Save a file. |
schema | Show the schema of a SQLite database. |
select | Select only these columns or rows from the input. Opposite of `reject`. |
seq | Output sequences of numbers. |
seq char | Print a sequence of ASCII characters. |
seq date | Print sequences of dates. |
shells | Lists all open shells. |
shuffle | Shuffle rows randomly. |
size | Gather word count statistics on the text. |
skip | Skip the first several rows of the input. Counterpart of `drop`. Opposite of `first`. |
skip until | Skip elements of the input until a predicate is true. |
skip while | Skip elements of the input while a predicate is true. |
sleep | Delay for a specified amount of time. |
sort | Sort in increasing order. |
sort-by | Sort by the given columns, in increasing order. |
source | Runs a script file in the current context. |
source-env | Source the environment from a source file into the current environment. |
split | Split contents across desired subcommand (like row, column) via the separator. |
split chars | Split a string into a list of characters. |
split column | Split a string into multiple columns using a separator. |
split list | Split a list into multiple lists using a separator. |
split row | Split a string into multiple rows using a separator. |
split words | Split a string's words into separate rows. |
split-by | Create a new table split. |
start | Open a folder, file or website in the default application or viewer. |
str | Various commands for working with string data. |
str camel-case | Convert a string to camelCase. |
str capitalize | Capitalize first letter of text. |
str collect | Deprecated command. |
str contains | Checks if string input contains a substring. |
str distance | Compare two strings and return the edit distance/Levenshtein distance. |
str downcase | Make text lowercase. |
str ends-with | Check if an input ends with a string. |
str find-replace | Deprecated command. |
str index-of | Returns start index of first occurrence of string in input, or -1 if no match. |
str join | Concatenate multiple strings into a single string, with an optional separator between each. |
str kebab-case | Convert a string to kebab-case. |
str length | Output the length of any strings in the pipeline. |
str lpad | Deprecated command. |
str pascal-case | Convert a string to PascalCase. |
str replace | Find and replace text. |
str reverse | Reverse every string in the pipeline. |
str rpad | Deprecated command. |
str screaming-snake-case | Convert a string to SCREAMING_SNAKE_CASE. |
str snake-case | Convert a string to snake_case. |
str starts-with | Check if an input starts with a string. |
str substring | Get part of a string. Note that the start is included but the end is excluded, and that the first character of a string is index 0. |
str title-case | Convert a string to Title Case. |
str to-datetime | Deprecated command. |
str to-decimal | Deprecated command. |
str to-int | Deprecated command. |
str trim | Trim whitespace or specific character. |
str upcase | Make text uppercase. |
sys | View information about the system. |
table | Render the table. |
take | Take only the first n elements of a list, or the first n bytes of a binary value. |
take until | Take elements of the input until a predicate is true. |
take while | Take elements of the input while a predicate is true. |
term size | Returns a record containing the number of columns (width) and rows (height) of the terminal. |
timeit | Time the running time of a block. |
to | Translate structured data to a format. |
to csv | Convert table into .csv text . |
to html | Convert table into simple HTML. |
to json | Converts table data into JSON text. |
to md | Convert table into simple Markdown. |
to nuon | Converts table data into Nuon (Nushell Object Notation) text. |
to text | Converts data into simple text. |
to toml | Convert record into .toml text. |
to tsv | Convert table into .tsv text. |
to xml | Convert special record structure into .xml text. |
to yaml | Convert table into .yaml/.yml text. |
touch | Creates one or more files. |
transpose | Transposes the table contents so rows become columns and columns become rows. |
try | Try to run a block, if it fails optionally run a catch block. |
tutor | Run the tutorial. To begin, run: tutor. |
uniq | Return the distinct values in the input. |
uniq-by | Return the distinct values in the input by the given column(s). |
update | Update an existing column to have a new value. |
update cells | Update the table cells. |
upsert | Update an existing column to have a new value, or insert a new column. |
url | Various commands for working with URLs. |
url build-query | Converts record or table into query string applying percent-encoding. |
url encode | Converts a string to a percent encoded web safe string. |
url join | Converts a record to url. |
url parse | Parses a url. |
use | Use definitions from a module, making them available in your shell. |
values | Given a record or table, produce a list of its columns' values. |
version | Display Nu version, and its build configuration. |
view | Various commands for viewing debug information. |
view files | View the files registered in nushell's EngineState memory. |
view source | View a block, module, or a definition. |
view span | View the contents of a span. |
watch | Watch for file changes and execute Nu code when they happen. |
where | Filter values based on a row condition. |
which | Finds a program file, alias or custom command. |
while | Conditionally run a block in a loop. |
window | Creates a sliding window of `window_size` that slide by n rows/elements across input. |
with-env | Runs a block with an environment variable set. |
wrap | Wrap the value into a column. |
zip | Combine a stream with the input. |