色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術文章
文章詳情頁

python - 管道符和ssh傳文件

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

問題描述

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

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

請問這條命令怎么理解?還有,發現對文件夾進行這樣的操作會失敗,有什么辦法傳輸文件夾么?求指教

問題解答

回答1:命令參數解釋:

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>.

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

也就是說 -c 不壓縮文件,而是直接輸出到標準輸出。

gunzip -,不是從文件接收壓縮文件,而是從標準輸入接收。

|:管道>:重定向

整條命令分析

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

gzip -c aa.txt:壓縮aa.txt文件,并將壓縮后的結果輸出到標準輸出

ssh root@192.168.1.1 '命令':在遠程機器上執行命令

命令gunzip -c -:解壓文件,原壓縮文件是由標準輸入傳入的,輸出結果直接輸出到標準輸出

> /home/bb.txt:將標準輸出重定向到文件/home/bb.txt

對文件夾進行這樣的操作會失敗

gzip不支持對目錄操作

回答2:

你要么完全換用netcat來收發。要么,本地tar壓縮一下,對端解壓縮。

回答3:

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

標簽: Python 編程
相關文章:
主站蜘蛛池模板: 欧美特黄aaaaaaaa大片 | 久久一区二区三区免费 | 成人国产精品999视频 | 一区二区三区视频免费观看 | 日日摸夜夜搂人人要 | 久久精品a一国产成人免费网站 | 亚洲伊人久久综合影院2021 | 欧美一级毛片欧美一级成人毛片 | 欧美xxxx成人免费网站 | 99久久精品免费看国产免费 | 一级做a爰片久久毛片欧美 一级做a爰片久久毛片人呢 | 最新国产精品好看的国产精品 | 亚洲精彩视频在线观看 | 日本欧美久久久久免费播放网 | 五月天婷婷伊人 | 黄视频欧美 | 无遮挡一级毛片私人影院 | 欧美透逼 | 日本一区二区高清免费不卡 | 国产素人在线观看 | 免费播放美女一级毛片 | 97超级碰碰碰免费公开在线观看 | 免费一级a毛片在线播 | 87精品福利视频在线观看 | 成年片免费网址网站 | 欧美人成毛片在线播放 | 窝窝午夜精品一区二区 | 国自产精品手机在线视频香蕉 | 91精品国产福利尤物免费 | 亚洲国产精品久久卡一 | 亚洲羞羞裸色私人影院 | 中国内地毛片免费高清 | 正在播放国产一区 | a级日韩乱理伦片在线观看 a级特黄毛片免费观看 | 久久久久久青草大香综合精品 | 欧美日韩一区二区三区在线播放 | 一区二区三区四区国产精品 | 在线观看偷拍视频一区 | 很黄很色的摸下面的视频 | 国产精品久久永久免费 | 成人精品网 |