The fold command reads the content from the specified file, adds the columns that exceed the specified column width to the column, and then outputs the content to the standard output device. If no file name is specified or the given file name is "-", The fold command reads data from the standard input device.
Syntax
Fold [-bs] [-w <number of lines per column>] [-- help] [-- version] [file...]
Parameters:
- -B or -- bytes calculates the column width in bytes, rather than the number of rows.
- -S or -- spaces use space characters as column points.
- -W <number of rows per column> or -- width <number of rows per column> sets the maximum number of rows per column.
- -- Help online help.
- -- Version: displays the version information.
Instance
Fold the row of a file named testfile to 30 in width. Run the following command:
Fold-w 30 testfile
To compare, output the testfile file as follows:
$ Cat testfile # View content in testfile
Linux networks are becoming more and more common,
Security is often an overlooked
Issue. Unfortunately, in today's environment all networks
Are potential hacker targets,
From top-secret military research networks to small home LANs.
Linux Network Security focuses on securing Linux in
Networked environment, where
Security of the entire network needs to be considered
Rather than just isolated machines.
It uses a mix of theory and practical techniques
Teach administrators how to install and
Use security applications, as well as how
Applications work and why they are necessary.
Then use the fold command to fold the display:
$ Fold-w 30 testfile # The row is folded to 30 in width and the testfile file is displayed.
Linux networks are becoming mo
Re and more common, but securi
Ty is often an overlooked issu
E. Unfortunately, in today's
Environment all networks are
Potential hacker targets, from
Top-secret military research
Networks to small home LANs.
Linux Network Security focuses
On securing Linux in a networ
Ked environment, where the sec
Urity of the entire network ne
Eds to be considered rather th
An just isolated machines. It
Uses a mix of theory and pract
Ical techniques to teach admin
Istrators how to install and u
Se security applications, as w
Ell as how the applications wo
Rk and why they are necessary