Linux管道符和ssh传文件,,看到可以用一条命令传输文
Linux管道符和ssh传文件,,看到可以用一条命令传输文
看到可以用一条命令传输文件
gzip -c aa.txt | ssh root@192.168.1.1 " gunzip -c - > /home/bb.txt"
请问这条命令怎么理解?
还有,发现对文件夹进行这样的操作会失败,有什么办法传输文件夹么?
求指教
管道是将前一个命令输出作为输入。 也可以先压缩成一个临时文件,再用scp
你要么完全换用netcat来收发。
要么,本地tar压缩一下,对端解压缩。
命令参数解释:
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, --help give this help -l, --list list compressed file contents -L, --license display software license -n, --no-name do not save or restore the original name and time stamp -N, --name save 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, --test test compressed file integrity -v, --verbose verbose mode -V, --version display version number -1, --fast compress faster -9, --best compress 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, --help give this help -l, --list list compressed file contents -L, --license display software license -n, --no-name do not save or restore the original name and time stamp -N, --name save 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, --test test compressed file integrity -v, --verbose verbose mode -V, --version display version number -1, --fast compress faster -9, --best compress 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不支持对目录操作
编橙之家文章,
相关内容
- pycharm方便Pyramid项目跳转怎样实现,pycharmpyramid,怎么让
- Python一行代码运行顺序是怎样的?,python一行代码顺序
- Python非命令行环境下如何看到程序效果,python命令行
- django web开妈中随机获取某个分类下的文章的方法,dj
- python cmd窗口命令提示窗口关闭方法,pythoncmd,import oso
- python web缓存数据更新判断如何实现,pythonweb,问题情景
- python tornado mongo驱动应该如何选择,tornadomongo,背景我用
- pyton celery工作流的问题,pytoncelery工作流,celery中,我做这
- 理论方面Python可以编译小Python内核数量是多少,python内
- Python禁用输出缓冲除-u外的其它方法是什么?,python-u,
评论关闭