Linux file upload, download, packaging, decompression
Linux file upload
Linux files refer to other machines (eg: Windows) that transfer files to Linux machines.
Below we use scp
the command to do this:
scp 本地目录 user@ip:Linux文件存放目录
open git console
Because Windows does not support the scp command, additional software implementation is required, and the git software supports Linux commands. Usually do software development, but also often use git.
Enter the scp command, such as:
scp d:/1.txt zhang@192.168.199.198:/home/zhang/test
The result is as follows:
Linux file download
The download is very simple, in the git console, enter the following command:
# 将1.txt拷贝到 D盘
scp zhang@192.168.199.198:/home/zhang/test/1.txt d:/
As shown in the figure:
Linux file packaging and compression
Linux often uses the tar command. Let's use the tar command to package.
tar -cvf log.tar 1.log 仅打包,不压缩!
# 如果加上 z 表示以.tar.gz或tgz来代表gzip压缩过的tar包
tar -zcvf log.tar.gz 2.log 打包后,以 gzip 压缩
# 如果加上 j 表示以.tar.bz2来代表bzip2压缩过的tar包
tar -jcvf log.tar.bz2 3.log 打包后,以 bzip2 压缩
As shown in the figure:
Linux file decompression
tar decompress
tar -xvf log.tar
tar.gz decompress
tar -zxvf log.tar.gz
tar.bz2 decompression
tar -jxvf log.tar.bz2
Query files in tar archive
tar -jtv -f filename.tar.bz2
tar -jtv -f filename.tar.gz