Home Explore Blog CI



nushell

commands/docs/fill.md
0b00089b421dd7205fac182bcd220df546e132265939ed51000000030000081b
---
title: fill
categories: |
  conversions
version: 0.104.0
conversions: |
  Fill and Align.
usage: |
  Fill and Align.
editLink: false
contributors: false
---
<!-- This file is automatically generated. Please edit the command in https://github.com/nushell/nushell instead. -->

# `fill` for [conversions](/commands/categories/conversions.md)

<div class='command-title'>Fill and Align.</div>

## Signature

```> fill {flags} ```

## Flags

 -  `--width, -w {int}`: The width of the output. Defaults to 1
 -  `--alignment, -a {string}`: The alignment of the output. Defaults to Left (Left(l), Right(r), Center(c/m), MiddleRight(cr/mr))
 -  `--character, -c {string}`: The character to fill with. Defaults to ' ' (space)


## Input/output types:

| input          | output       |
| -------------- | ------------ |
| filesize       | string       |
| float          | string       |
| int            | string       |
| list\<any\>      | list\<string\> |
| list\<filesize\> | list\<string\> |
| list\<float\>    | list\<string\> |
| list\<int\>      | list\<string\> |
| list\<string\>   | list\<string\> |
| string         | string       |
## Examples

Fill a string on the left side to a width of 15 with the character '─'
```nu
> 'nushell' | fill --alignment l --character '─' --width 15
nushell────────
```

Fill a string on the right side to a width of 15 with the character '─'
```nu
> 'nushell' | fill --alignment r --character '─' --width 15
────────nushell
```

Fill an empty string with 10 '─' characters
```nu
> '' | fill --character '─' --width 10
──────────
```

Fill a number on the left side to a width of 5 with the character '0'
```nu
> 1 | fill --alignment right --character '0' --width 5
00001
```

Fill a number on both sides to a width of 5 with the character '0'
```nu
> 1.1 | fill --alignment center --character '0' --width 5
01.10
```

Fill a filesize on both sides to a width of 10 with the character '0'
```nu
> 1kib | fill --alignment middle --character '0' --width 10
0001024000
```

Chunks
ed052660 (1st chunk of `commands/docs/fill.md`)
Title: fill
Summary
The `fill` command in Nushell is used for padding and aligning strings, numbers, or file sizes. It takes flags for specifying the width, alignment (left, right, center), and the character to use for padding. The command can be used to format output by adding characters to either side of a string until it reaches a specified width, providing control over alignment and appearance.