This tip is about the how to Use fold Command in Linux. So read this free guide, How to Use fold Command in Linux step by step. If you have query related to same article you may contact us.
How to Use fold Command in Linux – Guide
On Linux, the fold command wraps each line in an input file to a specified width and sends it to standard output. It wraps rows with a maximum width of 80 columns by default, although this can be changed. Folding input using the fold command requires a file or standard input.
Using the fold command:
$fold GfG.txt
In the example above we passed a text file called GfG to the fold command and as you can see in the output it wraps the line up for 80 columns.
Different bend command options:
In the example above, we wrap the lines of GfG.txt to a width of 60 columns.
In the example above, we limited the output width of the file to 40 bytes and the command breaks the output to 40 bytes.
If you compare the example above with the previous one, you will see that the lines only break at spaces, whereas in other examples the output is displayed in such a way that some of the words are broken between the lines.
Final note
I hope you like the guide How to Use fold Command in Linux. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.