Fold (Unix)
Encyclopedia
Fold is a Unix
Unix
Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

 command used for making a file with long lines more readable on a limited width terminal. Most Linux
Linux
Linux is a Unix-like computer operating system assembled under the model of free and open source software development and distribution. The defining component of any Linux system is the Linux kernel, an operating system kernel first released October 5, 1991 by Linus Torvalds...

 terminals have a default screen width of 80, and therefore reading files with long lines could get annoying. The fold command puts a line feed every X characters if it doesn't reach a new line before that point. If the '-w' argument is set, the fold command allows the user to set the maximum length of a line.

To fold a file to have 30 characters max per line, simply run the following command in your unix shell:
fold -w 30 file.txt

See also

  • fmt
  • par
    Par (command)
    The computer program par is a text formatting utility for Unix, written by Adam M. Costello as a replacement for the fmt command.Par reformats paragraphs of text to fit into a given line length optimally, keeping prefixes and suffixes intact, which is useful for formatting source code comments...

  • List of Unix commands
  • Text mode#PC common text modes
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK