Skip to content

Using the Linux fold command to make text more readable

The Linux fold takes lines of text and breaks them into chunks based on the arguments that you provide. With no arguments, fold will break lines at 80 characters.

The first example below uses a single-line text file that includes indications of character positions. First, we count the number of characters and lines in the file using the wc -l and wc -l command:

$ wc -c wide_text
251 wide_text
$ wc -l wide_text
1 wide_text

So, this file has 251 characters (including a carriage return) and a single line of text. Next, we display the file using the cat command:

To read this article in full, please click here

Source:: Network World – Data Center