border - Linux


The border command creates a border around a given text or file content. It’s commonly used to emphasize or frame text for visual appeal or clarity, making it a useful tool in text processing and formatting.


border [options] [text_or_file]


  • -h, –help: Display help information and exit.
  • -n, –no_terminal: Do not interpret ANSI escape sequences in the input text.
  • -p, –prefix: Specify a prefix to be added before the border.
  • -s, –suffix: Specify a suffix to be added after the border.
  • -w, –width: Set the width of the border. Default is 80.


Simple Border:

This is a simple border.

Border with Prefix and Suffix:

This text has a border with a prefix and suffix.

Border around File Content:

Common Issues

Empty Output:

If the input text is empty or contains only spaces, the border command will not produce any output. Ensure the input text has visible characters.

Unwanted ANSI Escape Sequences:

If the input text contains ANSI escape sequences and the -n option is not used, the border may appear distorted or contain unexpected characters. Remove the escape sequences or use -n to prevent interpretation.


Chain with Other Commands:

The border command can be chained with other commands to create custom text formatting pipelines. For example:

echo "Text" | tr [:lower:] [:upper:] | border

This creates a bordered text where the characters are all uppercase.

Related Commands

  • col: Format text into columns.
  • fmt: Format text for better readability.
  • fold: Wrap long lines of text.