English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The Linux fold command is used to limit the column width of files.
The fold command reads content from the specified file, adds an increment character to columns exceeding the specified column width, and outputs it to the standard output device. If no file name is specified, or the given file name is-If so, the fold command will read data from the standard input device.
fold [-bs][-w<column lines>][--help][--version][file...]
parameters:
-b or--bytes Calculate column width in bytes, not in line number units.
-s or--spaces Use space characters as the column break.
-w<number of lines per column> or--width<number of lines per column> Set the maximum number of lines per column.
--help Online help.
--version Show version information.
Fold the lines of a file named testfile to a width of30, you can use the following command:
fold -w 30 testfile
For comparison, first output the testfile file as follows:
$ cat testfile # View the content of testfile Linux networks are becoming more and more common, but security is often an overlooked issue. Unfortunately, in today’s environment all networks are potential hacker targets, from top-from secret military research networks to small home LANs. Linux Network Security focuses on securing Linux in a networked environment, where the the security of the entire network needs to be considered rather than just isolated machines. It uses a mix of theory and practical techniques to teach administrators how to install and use security applications, as well as how the applications work and why they are necessary.
Then use the fold command to fold and display:
$ fold -w 30 testfile # Line folding to width of30, display testfile file 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 from 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 administrators how to install and u se security applications, as w ell as how the applications wo rk and why they are necessary