The tar command not only extracts a package, but also extracts the files that are specified in the software package. Today a friend asked me, I just went to find the information, hehe
root@ubuntu:/tmp# tar-tf json-1.2.1.tgz
package.xml
json-1.2.1/readme json-1.2.1/config.m4
Json-1.2.1/config.w32
json-1.2.1/json.dsp
json-1.2.1/json.c
json-1.2.1/json_parser.c
Json-1.2.1/json_parser.h
json-1.2.1/php_json.h
json-1.2.1/utf8_decode.c
json-1.2.1/utf8_decode.h
json-1.2.1/utf8_to_utf16.c
json-1.2.1/utf8_to_utf16.h
json-1.2.1/tests/fail001.phpt
Json-1.2.1/tests/pass001.phpt
json-1.2.1/tests/pass001.1.phpt
json-1.2.1/tests/pass002.phpt
Json-1.2.1/tests/pass003.phpt
For example, to extract json.c This file, you can use the following
root@ubuntu:/tmp# Tar xf json-1.2.1.tgz json-1.2.1/json.c
tar:a Lone Zero block at 228 root@ubuntu:/tmp# Ls
json-1.2.1 json-1.2.1.tgz
root@ubuntu:/tmp# ls json-1.2.1/
json.c
See, has been decompressed out.
We can also extract multiple files inside.
root@ubuntu:/tmp# Tar xf json-1.2.1.tgz json-1.2.1/tests/pass003.phpt json-1.2.1/tests/pass002.phpt
Tar:a Lone Zero block at 228
root@ubuntu:/tmp# ls
json-1.2.1 json-1.2.1.tgz root@ubuntu:/tmp#
ls json-1.2.1/tests/
pass002.phpt pass003.phpt
OK, the files we need are already unpacked.