centos

centos extract官方文档

小樊
51
2025-10-24 01:28:52
栏目: 智能运维

Note: CentOS does not include an official extract command by default. The term “extract” typically refers to using standard command-line tools like tar, unzip, or 7z for decompressing files. Below is a consolidated guide to common extraction tasks in CentOS, based on official documentation and community best practices.

Common Extraction Tools in CentOS

CentOS relies on the following tools for handling compressed files:

1. Using tar for Tar-Based Archives

tar is the most versatile tool for extracting tar-based archives (common in CentOS repositories and software bundles).

Basic Syntax

tar -xvf <archive_name>.tar[.gz|.bz2|.xz] [-C <target_directory>]

Examples

View Archive Contents Without Extracting

tar -tzvf archive.tar.gz  # For .tar.gz files
tar -tjf archive.tar.bz2  # For .tar.bz2 files

2. Using unzip for ZIP Files

For .zip archives (common in cross-platform scenarios), install unzip first if not available:

sudo yum install unzip

Basic Syntax

unzip <archive_name>.zip [-d <target_directory>]

Examples

3. Using 7z for 7z Files

For .7z archives (high-compression format), install the p7zip package:

sudo yum install p7zip p7zip-plugins

Basic Syntax

7z x <archive_name>.7z [-o<target_directory>]

Example

Key Notes

For advanced use cases (e.g., extracting specific files from an archive), refer to the tool’s man pages:

man tar
man unzip
man 7z

0
看了该问题的人还看了