Under the ubuntu20.04 system, decompress the .7z file to the specified directory

Problem Description

  • Environment: ubuntu 20.04

  • There is a 7z compressed file under ubuntu that needs to be decompressed, and it needs to be decompressed to a specified directory, not the current directory of the compressed package

Install p7zip-full

  • 7z decompression software under ubuntu:p7zip-full

  • Install command:sudo apt install p7zip-full

Extract the 7z file

  • 7z x file.7zBy default, it will file.7zdecompress to the current directory of the compressed package

  • 7z x file.7z -r -o /home/rtt/Unzip to the specified directory, but prompt [operation failed]

  • The original parameter -ocannot have a space after it, that is, -othere cannot be a space between the parameter of the 7z command and the specified output path

  • Correct operation 7z decompression command such as: 7z x 20230209uboot.7z -r -o/home/rtt/linux/uboot/, 20230209uboot.7zdecompress the compressed file to /home/rtt/linux/uboot/the path

Description of 7z decompression command parameters

  • xIndicates decompression, note that not -x, onlyx

  • -rRecursively decompress all subfolders

  • -oSpecify the directory to be decompressed, [Note]: -oThere is no space between the decompressed path, such as -o/home/rttthe output directory is/home/rtt

The actual operation of 7z decompression to the specified directory

  • $ 7z x 20230209uboot.7z -r -o/home/rtt/linux/uboot/
$ 7z x 20230209uboot.7z -r -o/home/rtt/linux/uboot/

7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,2 CPUs Intel(R) Core(TM) i5-9400 CPU @ 2.90GHz (906EA),ASM,AES-NI)

Scanning the drive for archives:
1 file, 17286828 bytes (17 MiB)

Extracting archive: 20230209uboot.7z
--
Path = 20230209uboot.7z
Type = 7z
Physical Size = 17286828
Headers Size = 186757
Method = LZMA:25 BCJ
Solid = +
Blocks = 2

Everything is Ok

Folders: 2127
Files: 18080
Size:       143007444
Compressed: 17286828
  • After the 7z decompression command is executed, lscheck through the command, and the operation of decompressing the file to the specified directory is executed correctly
rtt@ubuntu:~/linux/uboot$ ls
uboot        /* 解压缩后的文件目录 */

summary

  • The ubuntu 20.04 version is more classic, usually accumulate some operating experience and use it in actual embedded software development

  • The Linux 7z decompression command can also compress files. For detailed parameters and instructions, you can view the help of the command. If you only enter it, the 7zparameters of the 7z command will be listed

insert image description here

Guess you like

Origin blog.csdn.net/tcjy1000/article/details/128988597