国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術(shù)文章
文章詳情頁

python - 管道符和ssh傳文件

瀏覽:108日期:2022-09-21 11:56:13

問題描述

看到可以用一條命令傳輸文件

gzip -c aa.txt | ssh root@192.168.1.1 ' gunzip -c - > /home/bb.txt'

請(qǐng)問這條命令怎么理解?還有,發(fā)現(xiàn)對(duì)文件夾進(jìn)行這樣的操作會(huì)失敗,有什么辦法傳輸文件夾么?求指教

問題解答

回答1:命令參數(shù)解釋:

gzip -h

Usage: gzip [OPTION]... [FILE]...Compress or uncompress FILEs (by default, compress FILES in-place).Mandatory arguments to long options are mandatory for short options too. -c, --stdout write on standard output, keep original files unchanged -d, --decompress decompress -f, --force force overwrite of output file and compress links -h, --helpgive this help -l, --listlist compressed file contents -L, --license display software license -n, --no-name do not save or restore the original name and time stamp -N, --namesave or restore the original name and time stamp -q, --quiet suppress all warnings -r, --recursive operate recursively on directories -S, --suffix=SUF use suffix SUF on compressed files -t, --testtest compressed file integrity -v, --verbose verbose mode -V, --version display version number -1, --fastcompress faster -9, --bestcompress better --rsyncable Make rsync-friendly archiveWith no FILE, or when FILE is -, read standard input.

gunzip -h

Usage: gzip [OPTION]... [FILE]...Compress or uncompress FILEs (by default, compress FILES in-place).Mandatory arguments to long options are mandatory for short options too. -c, --stdout write on standard output, keep original files unchanged -d, --decompress decompress -f, --force force overwrite of output file and compress links -h, --helpgive this help -l, --listlist compressed file contents -L, --license display software license -n, --no-name do not save or restore the original name and time stamp -N, --namesave or restore the original name and time stamp -q, --quiet suppress all warnings -r, --recursive operate recursively on directories -S, --suffix=SUF use suffix SUF on compressed files -t, --testtest compressed file integrity -v, --verbose verbose mode -V, --version display version number -1, --fastcompress faster -9, --bestcompress better --rsyncable Make rsync-friendly archiveWith no FILE, or when FILE is -, read standard input.Report bugs to <bug-gzip@gnu.org>.

不知道鬧哪樣,兩條命令的幫助文檔是一樣的,開發(fā)者偷懶了

也就是說 -c 不壓縮文件,而是直接輸出到標(biāo)準(zhǔn)輸出。

gunzip -,不是從文件接收壓縮文件,而是從標(biāo)準(zhǔn)輸入接收。

|:管道>:重定向

整條命令分析

gzip -c aa.txt | ssh root@192.168.1.1 'gunzip -c - > /home/bb.txt'

gzip -c aa.txt:壓縮aa.txt文件,并將壓縮后的結(jié)果輸出到標(biāo)準(zhǔn)輸出

ssh root@192.168.1.1 '命令':在遠(yuǎn)程機(jī)器上執(zhí)行命令

命令gunzip -c -:解壓文件,原壓縮文件是由標(biāo)準(zhǔn)輸入傳入的,輸出結(jié)果直接輸出到標(biāo)準(zhǔn)輸出

> /home/bb.txt:將標(biāo)準(zhǔn)輸出重定向到文件/home/bb.txt

對(duì)文件夾進(jìn)行這樣的操作會(huì)失敗

gzip不支持對(duì)目錄操作

回答2:

你要么完全換用netcat來收發(fā)。要么,本地tar壓縮一下,對(duì)端解壓縮。

回答3:

管道是將前一個(gè)命令輸出作為輸入。 也可以先壓縮成一個(gè)臨時(shí)文件,再用scp

標(biāo)簽: Python 編程
相關(guān)文章:
主站蜘蛛池模板: 亚洲成人手机在线 | 国产成人cao在线 | 暴操美女| 天天亚洲 | www.久草.com| 色欧美在线| 国产免费一级精品视频 | 国产精品日本不卡一区二区 | 欧美午夜免费毛片a级 | 免费国产成人手机在线观看 | 三级视频在线 | 亚洲精品在线免费 | 男女牲高爱潮免费视频男女 | 久久精品成人一区二区三区 | 亚洲欧洲日韩在线 | a一级特黄日本大片 s色 | 久久亚洲私人国产精品 | 精品成人在线观看 | 国产精品成久久久久三级 | 女人张开腿让男人捅爽 | 一本色道久久88亚洲精品综合 | 美女18一级毛片免费看 | 中文字幕一区二区视频 | 久久精品国产亚洲高清 | 超清波多野结衣精品一区 | 久草在线播放视频 | 美女毛片免费 | 老司机亚洲精品影院在线 | 免费精品久久久久久中文字幕 | 欧美日韩偷拍自拍 | 亚洲精品视频久久 | 精品色视频 | 最新步兵社区在线观看 | 亚洲美女精品视频 | 91年精品国产福利线观看久久 | 一级毛片在线免费播放 | 免费观看一级成人毛片 | 亚洲成人自拍网 | 免费特黄级夫费生活片 | 综合免费视频 | 中文字幕二区 |