指令最終章)
今天記住了一個(gè)熱鍵CTRLR搜索歷史指令分享給大家目錄一、文件內(nèi)容查看1.1 cat 與 tac :正序 / 倒序查看文件tac反過來就是cat1.3 more與less 分頁查看大文件1.4 head與tail1.5 如果只顯示中間某部分的內(nèi)容數(shù)據(jù)流轉(zhuǎn)管道|二、時(shí)間與日歷date 與 cal2.1 date:2.2 時(shí)間戳2.3 cal :查看公歷三、搜索工具3.1 find 在目錄樹中遍歷搜索文件3.2 whereis 查找文件找到文件的源3.3 grep在文件中搜索字符串四、系統(tǒng)監(jiān)控top 查看進(jìn)程動(dòng)態(tài)五、文件壓縮與解壓zip 和 unzip一、文件內(nèi)容查看1.1 cat 與 tac :正序 / 倒序查看文件tac反過來就是cat功能查看目標(biāo)文件內(nèi)容適合查小文件如果是大文件可以用more和less下文會(huì)說常用選項(xiàng)-b 對(duì)非空輸出行編號(hào)空行不做編號(hào)-n 對(duì)輸出的所有行編號(hào)-s 不輸出多行空行示例ubuntuVM-0-4-ubuntu:~$ echo hello world data.txt ubuntuVM-0-4-ubuntu:~$ cat data.txt hello world ubuntuVM-0-4-ubuntu:~$ echo hello world data.txt ubuntuVM-0-4-ubuntu:~$ echo hello data.txt ubuntuVM-0-4-ubuntu:~$ cat -n data.txt 1 hello world 2 hello world 3 hello ubuntuVM-0-4-ubuntu:~$ cat data.txt hello world hello world hello world hello ubuntuVM-0-4-ubuntu:~$ cat -n data.txt #-n 對(duì)所以行編號(hào) 1 hello world 2 hello world 3 4 5 6 7 8 hello world 9 hello ubuntuVM-0-4-ubuntu:~$ cat -s data.txt #-s 將多行空行壓縮為一行 hello world hello world hello world hello ubuntuVM-0-4-ubuntu:~$ cat -n data.txt #-s不會(huì)對(duì)文本造成影響 1 hello world 2 hello world 3 4 5 6 7 8 hello world 9 hello ubuntuVM-0-4-ubuntu:~$ cat -b data.txt #-b 則對(duì)非空行進(jìn)行編號(hào) 1 hello world 2 hello world 3 hello world 4 hello #驗(yàn)證tac指令的功能 ubuntuVM-0-4-ubuntu:~$ echo 1111 data.txt ubuntuVM-0-4-ubuntu:~$ cat data.txt hello world hello world hello world hello 1111 ubuntuVM-0-4-ubuntu:~$ tac data.txt 1111 #先打的最后一個(gè)倒序輸出的 hello hello world hello world hello world1.2 nano linux下的記事本功能可以打開文件相當(dāng)于記事本的功能語法nano 文件名示例輸入如下指令后可以打開data.txt并且對(duì)該文本進(jìn)行編輯ubuntuVM-0-4-ubuntu:~$ nano data.txt在下面的眾多選項(xiàng)中^表示ctrl同時(shí)按下CTRL和其他鍵可以達(dá)到不同的效果。這里我加了一些空行在里面目的是為了驗(yàn)證1.1中的cat的其他擴(kuò)展的功能。常用快捷鍵保存文件Ctrl O按下后按 Enter 確認(rèn)保存。退出編輯器Ctrl X若文件未保存會(huì)提示是否保存按 Y 確認(rèn)N 放棄按enter退出查找文本Ctrl W輸入關(guān)鍵詞后按 Enter 查找按 Alt W 繼續(xù)查找下一個(gè)剪切當(dāng)前行Ctrl K粘貼Ctrl U撤銷Ctrl _1.3 more與less 分頁查看大文件more功能會(huì)分頁打印文件的內(nèi)容用/內(nèi)容可以搜索文件內(nèi)容但是缺點(diǎn)是只能用回車下翻不能回到上一頁比較麻煩。優(yōu)點(diǎn)則是不會(huì)刷屏常用選項(xiàng)-n 指定輸出行數(shù)-q 退出more/內(nèi)容 搜索比如/helloEnter 向下搜示例ubuntuVM-0-4-ubuntu:~$ more -20 data.txt #-20代表每頁輸出20行 hello world hello world hello world hello 1111 hello Lotso hello Lotso hello Lotso hello Lotso hello Lotso hello Lotso hello Lotso hello Lotso hello Lotso hello Lotso --More--(0%)less功能相比于more可以上下翻動(dòng)很好用在開發(fā)中常用less其功能更加全面常用選項(xiàng)i忽略搜索時(shí)的大小寫-N顯示每行的行號(hào)/字符串向下搜索該字符串?字符串向上搜索該字符串n重復(fù)前一個(gè)搜索與 / 或 ? 有關(guān)N反向重復(fù)前一個(gè)搜索與 / 或 有關(guān)q退出ubuntuVM-0-4-ubuntu:~$ less -N temp.txt 1 hello 0 2 hello 1 3 hello 2 4 hello 3 5 hello 4 6 hello 5 7 hello 6 8 hello 7 9 hello 8 10 hello 9 11 hello 10 12 hello 11 13 hello 12 14 hello 13 15 hello 14 16 hello 15 17 hello 16 18 hello 17 19 hello 18 20 hello 19 21 hello 20 22 hello 21 23 hello 22 24 hello 23 25 hello 24 26 hello 25 27 hello 26 28 hello 27 29 hello 28 30 hello 29 13 hello 12 14 hello 13 15 hello 14 16 hello 15 17 hello 16 18 hello 17 19 hello 18 20 hello 19 21 hello 20 22 hello 21 23 hello 22 24 hello 23 25 hello 24 26 hello 25 27 hello 26 28 hello 27 29 hello 28 30 hello 29 31 hello 30 32 hello 31 33 hello 32 34 hello 33 35 hello 34 36 hello 35 37 hello 36 38 hello 37 39 hello 38 40 hello 39 41 hello 40 42 hello 41 43 hello 42 44 hello 43 1 hello 0 2 hello 1 3 hello 2 1 hello 0 2 hello 1 3 hello 2 4 hello 3 5 hello 4 6 hello 5 7 hello 6 8 hello 7 9 hello 8 10 hello 9 11 hello 10 12 hello 11 13 hello 12 14 hello 13 15 hello 14 16 hello 15 17 hello 16 18 hello 17 19 hello 18 20 hello 19 21 hello 20 22 hello 21 23 hello 22 24 hello 23 25 hello 24 26 hello 25 27 hello 26 28 hello 27 29 hello 28 30 hello 29 31 hello 30 :注這里只給出-N的演示其他的搜索因?yàn)檩斎牒笙Я斯什徽故玖?.4 head與tailhead和tail的功能都非常簡單默認(rèn)分別用于顯示文件的前 10 行和后 10 行示例如下ubuntuVM-0-4-ubuntu:~$ head temp.txt #head默認(rèn)顯示前10行 hello 0 hello 1 hello 2 hello 3 hello 4 hello 5 hello 6 hello 7 hello 8 hello 9 ubuntuVM-0-4-ubuntu:~$ head -n5 temp.txt #head -n5與head -5效果一樣 hello 0 hello 1 hello 2 hello 3 hello 4 ubuntuVM-0-4-ubuntu:~$ head -5 temp.txt hello 0 hello 1 hello 2 hello 3 hello 4 ubuntuVM-0-4-ubuntu:~$ tail -5 temp.txt hello 1996 hello 1997 hello 1998 hello 1999 hello 2000如上例所展示的如果想要顯示前或后幾行就加上 -n總結(jié)如下-n行數(shù)顯示的行數(shù)n可加可不加-f持續(xù)監(jiān)聽文件文件新增內(nèi)容會(huì)實(shí)時(shí)打印到終端1.5 如果只顯示中間某部分的內(nèi)容數(shù)據(jù)流轉(zhuǎn)管道|現(xiàn)在比如要顯示第200到210行的內(nèi)容本例從0開始的只需要用head提取前210行重定向到新文件再用tail提取新文件就可以了ubuntuVM-0-4-ubuntu:~$ head -210 temp.txt tempp.txt ubuntuVM-0-4-ubuntu:~$ tail -11 tempp.txt hello 199 hello 200 hello 201 hello 202 hello 203 hello 204 hello 205 hello 206 hello 207 hello 208 hello 209 ubuntuVM-0-4-ubuntu:~$這樣的思想被總結(jié)后產(chǎn)生了管道的概念管道符號(hào)|一句話核心把左邊命令的輸出直接當(dāng)作右邊命令的輸入語法命令1 | 命令2命令 1 正常會(huì)打印內(nèi)容到屏幕標(biāo)準(zhǔn)輸出 stdout 加管道|之后不輸出到屏幕直接傳給右邊命令作為右邊的標(biāo)準(zhǔn)輸入。那么上面的示例也可以概況為一句命令ubuntuVM-0-4-ubuntu:~$ head -210 temp.txt | tail -11 hello 199 hello 200 hello 201 hello 202 hello 203 hello 204 hello 205 hello 206 hello 207 hello 208 hello 209望文生義計(jì)算機(jī)中的管道只能從左向右同時(shí)管道還可以連接可以有多個(gè)管道稱為管道的級(jí)聯(lián)ubuntuVM-0-4-ubuntu:~$ head -210 temp.txt | tail -11 | tac #倒序輸出 hello 209 hello 208 hello 207 hello 206 hello 205 hello 204 hello 203 hello 202 hello 201 hello 200 hello 199 ubuntuVM-0-4-ubuntu:~$ head -210 temp.txt | tail -11 |wc -l #wc -l顯示行數(shù) 11匿名管道像上面的沒有名字的管道稱為匿名管道特點(diǎn)數(shù)據(jù)一旦被讀走緩沖區(qū)就清空不能重復(fù)讀管道容量有限一般幾 KB寫滿之后寫操作會(huì)阻塞等待讀讀空了讀操作會(huì)阻塞等待寫入只能單向A 寫 → B 讀不能同時(shí) A 讀 B 寫只能父子 / 兄弟進(jìn)程親緣進(jìn)程通信命名管道命名管道是存在文件系統(tǒng)里有文件名用 mkfifo 創(chuàng)建可以實(shí)現(xiàn)一個(gè)或多個(gè)終端的連接mkfifo myfifo ls -l myfifo有文件節(jié)點(diǎn)ls能看到無親緣進(jìn)程之間也可以通信同樣是內(nèi)存緩沖區(qū)數(shù)據(jù)不落地磁盤文件只是一個(gè)入口標(biāo)識(shí)二、時(shí)間與日歷date 與 cal2.1 date:這里直接給出示例ubuntuVM-0-4-ubuntu:~$ date Mon Sep 28 04:50:25 PM CST 2026 #這種是外國的輸出方式 ubuntuVM-0-4-ubuntu:~$ date %Y:%m:%d #進(jìn)行了格式化這里Y要大寫代表年m和d代表月和日 2026:09:28 ubuntuVM-0-4-ubuntu:~$ date %Y/%m/%d #與上一個(gè)的區(qū)別只有劃分的符號(hào)不同這個(gè)就比較簡單了 2026/09/28 ubuntuVM-0-4-ubuntu:~$ date %Y 2026 #也可以只顯示年或月或日同時(shí)還可以顯示時(shí)分秒擴(kuò)展如下%Y年份%m月份%d日期%H小時(shí)%M分鐘%S秒%s時(shí)間戳%F 相當(dāng)于%Y-%m-%d%T 相當(dāng)于%H:%M:%SubuntuVM-0-4-ubuntu:~$ date %F-%T # %F和%T間的-可以用其他符號(hào)代替但是不能為空 2026-09-28-16:58:09 ubuntuVM-0-4-ubuntu:~$2.2 時(shí)間戳概念從 1970-01-01 00:00:00 UTC格林威治時(shí)間到當(dāng)前時(shí)刻的總秒數(shù)也叫 Epoch 時(shí)間作用是生成日志日志可以用來排除錯(cuò)誤 。獲取時(shí)間戳用 %subuntuVM-0-4-ubuntu:~$ date %s 1790586197甚至可以指明時(shí)間戳的真實(shí)時(shí)間date %F %T -d 你獲取的數(shù)字ubuntuVM-0-4-ubuntu:~$ date %F-%T -d 1790586197 # 把剛剛拿到的時(shí)間戳轉(zhuǎn)回可讀時(shí)間 2026-09-28-17:03:17 ubuntuVM-0-4-ubuntu:~$ date %F-%T -d 0 1970-01-01-08:00:00 #可以看到時(shí)間是八點(diǎn)因?yàn)槭褂昧吮本┑臇|八區(qū)時(shí)間加上了8小時(shí)2.3 cal :查看公歷非常簡單只需要輸入cal即可ubuntuVM-0-4-ubuntu:~$ cal September 2026 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30如果沒法運(yùn)行可以按照提示輸入相關(guān)指令比如sudo apt install ncal常用擴(kuò)展-3顯示系統(tǒng)前一個(gè)月當(dāng)前月下一個(gè)月的月歷-j顯示在當(dāng)年中的第幾天(一年日期按天算從1月1號(hào)算起默認(rèn)顯示當(dāng)前月在一年中的天數(shù))-y顯示當(dāng)前年份的日歷ubuntuVM-0-4-ubuntu:~$ cal -3 August 2026 September 2026 October 2026 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 1 2 3 4 5 1 2 3 2 3 4 5 6 7 8 6 7 8 9 10 11 12 4 5 6 7 8 9 10 9 10 11 12 13 14 15 13 14 15 16 17 18 19 11 12 13 14 15 16 17 16 17 18 19 20 21 22 20 21 22 23 24 25 26 18 19 20 21 22 23 24 23 24 25 26 27 28 29 27 28 29 30 25 26 27 28 29 30 31 30 31 #顯示本月份每天為本年的第幾天 ubuntuVM-0-4-ubuntu:~$ cal -j September 2026 Su Mo Tu We Th Fr Sa 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 #顯示全年日歷 ubuntuVM-0-4-ubuntu:~$ cal -y 2026 January February March Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7 4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14 11 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21 18 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28 25 26 27 28 29 30 31 29 30 31 April May June Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 1 2 1 2 3 4 5 6 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13 12 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20 19 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27 26 27 28 29 30 24 25 26 27 28 29 30 28 29 30 31 July August September Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 1 1 2 3 4 5 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12 12 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19 19 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26 26 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30 30 31 October November December Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12 11 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19 18 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26 25 26 27 28 29 30 31 29 30 27 28 29 30 31還可以檢查指定年 月的日歷ubuntuVM-0-4-ubuntu:~$ cal 2024 #查看指定年的全部月 2024 January February March Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 1 2 3 1 2 7 8 9 10 11 12 13 4 5 6 7 8 9 10 3 4 5 6 7 8 9 14 15 16 17 18 19 20 11 12 13 14 15 16 17 10 11 12 13 14 15 16 21 22 23 24 25 26 27 18 19 20 21 22 23 24 17 18 19 20 21 22 23 28 29 30 31 25 26 27 28 29 24 25 26 27 28 29 30 31 April May June Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 1 2 3 4 1 7 8 9 10 11 12 13 5 6 7 8 9 10 11 2 3 4 5 6 7 8 14 15 16 17 18 19 20 12 13 14 15 16 17 18 9 10 11 12 13 14 15 21 22 23 24 25 26 27 19 20 21 22 23 24 25 16 17 18 19 20 21 22 28 29 30 26 27 28 29 30 31 23 24 25 26 27 28 29 30 July August September Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 1 2 3 1 2 3 4 5 6 7 7 8 9 10 11 12 13 4 5 6 7 8 9 10 8 9 10 11 12 13 14 14 15 16 17 18 19 20 11 12 13 14 15 16 17 15 16 17 18 19 20 21 21 22 23 24 25 26 27 18 19 20 21 22 23 24 22 23 24 25 26 27 28 28 29 30 31 25 26 27 28 29 30 31 29 30 October November December Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa 1 2 3 4 5 1 2 1 2 3 4 5 6 7 6 7 8 9 10 11 12 3 4 5 6 7 8 9 8 9 10 11 12 13 14 13 14 15 16 17 18 19 10 11 12 13 14 15 16 15 16 17 18 19 20 21 20 21 22 23 24 25 26 17 18 19 20 21 22 23 22 23 24 25 26 27 28 27 28 29 30 31 24 25 26 27 28 29 30 29 30 31 #查看指定月份注意月份在前 ubuntuVM-0-4-ubuntu:~$ cal 3 2026 March 2026 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31三、搜索工具3.1 find 在目錄樹中遍歷搜索文件語法find pathname -optionsfind的擴(kuò)展非常多用到再查需要記住的就是find name就可以u(píng)buntuVM-0-4-ubuntu:~$ find temp.txt temp.txt總結(jié)Linux下find命令在目錄結(jié)構(gòu)中搜索文件并執(zhí)行指定的操作。Linux下find命令提供了相當(dāng)多的查找條件功能很強(qiáng)大。由于find具有強(qiáng)大的功能所以它的選項(xiàng)也很多其中大部分選項(xiàng)都值得我們花時(shí)間來了解?下。即使系統(tǒng)中含有網(wǎng)絡(luò)文件系統(tǒng)( NFS)find命令在該文件系統(tǒng)中同樣有效只你具有相應(yīng)的權(quán)限。在運(yùn)行一個(gè)非常消耗資源的find命令時(shí)很多?都傾向于把它放在后臺(tái)執(zhí)行因?yàn)楸闅v一個(gè)大的文件系統(tǒng)可能會(huì)花費(fèi)很長的時(shí)間(這?是指30G字節(jié)以上的文件系統(tǒng))。3.2 whereis 查找文件找到文件的源ubuntuVM-0-4-ubuntu:~$ whereis ls ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz ubuntuVM-0-4-ubuntu:~$ whereis temp.txt temp.txt: ubuntuVM-0-4-ubuntu:~$ tree . ├── 1.txt ├── data.txt ├── snap │ └── tree │ ├── 54 │ ├── common │ │ └── marker_publisher_changed_announcement_shown │ └── current - 54 ├── temp │ └── myfile.txt ├── temp1 ├── tempp.txt └── temp.txt 8 directories, 6 files ubuntuVM-0-4-ubuntu:~$ whereis tree tree: /snap/bin/tree ubuntuVM-0-4-ubuntu:~$通過上述的樹可見如果當(dāng)前目錄下即可找到whereis的文件那么不會(huì)輸出地址了如果在其他分支則輸出地址3.3 grep在文件中搜索字符串示例ubuntuVM-0-4-ubuntu:~$ grep 99 temp.txt #雙引號(hào)中是要查找的東西 hello 99 hello 199 hello 299 hello 399 hello 499 hello 599 hello 699 hello 799 hello 899 hello 990 hello 991 hello 992 hello 993 hello 994 hello 995 hello 996 hello 997 hello 998 hello 999 hello 1099 hello 1199 hello 1299 hello 1399 hello 1499 hello 1599 hello 1699 hello 1799 hello 1899 hello 1990 hello 1991 hello 1992 hello 1993 hello 1994 hello 1995 hello 1996 hello 1997 hello 1998 hello 1999常用擴(kuò)展-i忽略大小寫的不同所有大小寫視為相同-n順便輸出其中其中文件中對(duì)應(yīng)位置的行號(hào)-v顯示出沒有 ‘搜尋字符串’ 內(nèi)容的行ubuntuVM-0-4-ubuntu:~$ grep -i abcd data.txt #忽略大小寫 ABCD abcd ubuntuVM-0-4-ubuntu:~$ grep -n abcd data.txt #順便輸出行號(hào) 4:abcd ubuntuVM-0-4-ubuntu:~$ grep -in abcd data.txt 3:ABCD 4:abcd ubuntuVM-0-4-ubuntu:~$ grep -v hello data.txt #排除式的輸出 ABCD abcd 1234 1111四、系統(tǒng)監(jiān)控top 查看進(jìn)程動(dòng)態(tài)功能用于實(shí)時(shí)監(jiān)控進(jìn)程和系統(tǒng)資源的核心命令能動(dòng)態(tài)顯示CPU內(nèi)存進(jìn)程等信息常用擴(kuò)展-d: 刷新的時(shí)間間隔-n: 刷新的次數(shù)q退出五、文件壓縮與解壓zip 和 unzip功能將文件壓縮為zip格式把zip解壓常用擴(kuò)展-r 遞歸處理將指定目錄下的所有文件和子目錄一并處理-d :解壓到指定路徑下示例ubuntuVM-0-4-ubuntu:~$ zip temp.zip temp.txt #中間為壓縮包名 adding: temp.txt (deflated 78%) ubuntuVM-0-4-ubuntu:~$ ubuntuVM-0-4-ubuntu:~$ unzip temp.zip -d ./ # -d 加載到指定路徑下不加就是默認(rèn)當(dāng)前路徑 Archive: temp.zip replace ./temp.txt? [y]es, [n]o, [A]ll, [N]one, [r]ename: y inflating: ./temp.txt ubuntuVM-0-4-ubuntu:~$ ls 1.txt data.txt snap temp temp1 tempp.txt temp.txt temp.zip ubuntuVM-0-4-ubuntu:~$打包和壓縮的區(qū)分打包和壓縮是一套動(dòng)作打包多變一為了防止丟失文件以及提升效率壓縮大變小是算法為什么打包壓縮用算法換時(shí)間常見的壓縮方式核心區(qū)分兩類zip壓縮 打包一體跨 Windows/Linuxtar先打包再配合 gzip /bzip2 /xz 做壓縮Linux 最主流ubuntuVM-0-4-ubuntu:~$ zip test.zip test adding: test/ (stored 0%) #不加-r而目錄中有兩個(gè)文件就失敗了 ubuntuVM-0-4-ubuntu:~$ unzip -l test.zip #unzip -l是只查看不解壓 Archive: test.zip Length Date Time Name --------- ---------- ----- ---- 0 2026-09-28 20:02 test/ --------- ------- 0 1 file #加了 -r 后成功壓縮了并且目錄也不為空 ubuntuVM-0-4-ubuntu:~$ zip -r test1.zip test adding: test/ (stored 0%) adding: test/b.txt (stored 0%) adding: test/a.txt (stored 0%) ubuntuVM-0-4-ubuntu:~$ unzip -l test1.zip Archive: test1.zip Length Date Time Name --------- ---------- ----- ---- 0 2026-09-28 20:02 test/ 4 2026-09-28 20:02 test/b.txt 4 2026-09-28 20:02 test/a.txt --------- ------- 8 3 filesrz與sz壓縮包怎么跨主機(jī)傳輸rz receive 服務(wù)器接收文件 →本地上傳文件到服務(wù)器sz send 服務(wù)器發(fā)送文件 →服務(wù)器下載文件到本地電腦輸入后可以選擇路徑可看到那么windows則可以用 rz 也可以拖拽以上就是本期全部的內(nèi)容。不知道你會(huì)不會(huì)看到這里不過我今天還是有點(diǎn)小焦慮的因?yàn)槲乙呀?jīng)大三開學(xué)了現(xiàn)在CPP還沒學(xué)啊啊啊啊今天吃了肉夾饃番茄牛肉拌飯