Quick Tour | Nushell

submited by
Style Pass
2024-06-09 05:00:02

The first thing you'll notice when you run a command like ls is that instead of a block of text coming back, you get a structured table.

The table does more than show the directory in a different way. Just like tables in a spreadsheet, this table allows us to work with the data more interactively.

The first thing we'll do is to sort our table by size. To do this, we'll take the output from ls and feed it into a command that can sort tables based on the contents of a column.

You can see that to make this work we didn't pass commandline arguments to ls. Instead, we used the sort-by command that Nu provides to do the sorting of the output of the ls command. To see the biggest files on top, we also used reverse.

Nu provides many commands that can work on tables. For example, we could use where to filter the contents of the ls table so that it only shows files over 1 kilobyte:

Just as in the Unix philosophy, being able to have commands talk to each other gives us ways to mix-and-match in many different combinations. Let's look at a different command:

Leave a Comment