Linux file upload, download, packaging, decompression

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 scpthe command to do this:

scp 本地目录 user@ip:Linux文件存放目录
  1. 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.

  2. Enter the scp command, such as:

    scp d:/1.txt zhang@192.168.199.198:/home/zhang/test
  3. The result is as follows:

image

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:

image

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:

image

Linux file decompression

tar decompress

tar -xvf log.tar

image

tar.gz decompress

tar -zxvf log.tar.gz

image

tar.bz2 decompression

tar -jxvf log.tar.bz2

image

Query files in tar archive

tar -jtv -f filename.tar.bz2

tar -jtv -f filename.tar.gz

image

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325684847&siteId=291194637