溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Linux常用命令fold怎么用

發(fā)布時(shí)間:2022-02-16 13:54:15 來源:億速云 閱讀:144 作者:小新 欄目:開發(fā)技術(shù)

這篇文章主要介紹了Linux常用命令fold怎么用,具有一定借鑒價(jià)值,感興趣的朋友可以參考下,希望大家閱讀完這篇文章之后大有收獲,下面讓小編帶著大家一起了解一下。

Linux常用命令fold命令用于限制文件列寬,fold指令會(huì)從指定的文件里讀取內(nèi)容,將超過限定列寬的列加入增列字符后,輸出到標(biāo)準(zhǔn)輸出設(shè)備。

Linux常用命令fold怎么用

語法

 fold [-bs][-w][--help][--version][文件...]

參數(shù)

  • -b或–bytes 以Byte為單位計(jì)算列寬,而非采用行數(shù)編號(hào)為單位。

  • -s或–spaces 以空格字符作為換列點(diǎn)。

  • -w或–width 設(shè)置每列的最大行數(shù)。

  • –help 在線幫助。

  • –version 顯示版本信息。

實(shí)例

將一個(gè)名為testfile 的文件的行折疊成寬度為30,可使用如下命令:

 fold -w 30 testfile

為了對(duì)比,先將testfile文件輸出如下:

 $ cat testfile #查看testfile 中的內(nèi)容  
 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-secret military research networks to small home LANs.  
 Linux Network Security focuses on securing Linux in a
 networked environment, where 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.

然后使用fold命令折疊顯示:

 $ fold -w 30 testfile #行折疊成寬度為30,顯示testfile 文件  
 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

感謝你能夠認(rèn)真閱讀完這篇文章,希望小編分享的“Linux常用命令fold怎么用”這篇文章對(duì)大家有幫助,同時(shí)也希望大家多多支持億速云,關(guān)注億速云行業(yè)資訊頻道,更多相關(guān)知識(shí)等著你來學(xué)習(xí)!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI