"In computing, tar (derived from tape archive and commonly referred to as "tarball") is both a file format (in the form of a type of archive bitstream) and the name of a program used to handle such files. The format was created in the early days of Unix and standardized by POSIX.1-1988 and later POSIX.1-2001.
Initially developed to be written directly to sequential I/O devices for tape backup purposes, it is now commonly used to collect many files into one larger file for distribution or archiving, while preserving file system information such as user and group permissions, dates, and directory structures.
We will now learn some useful command to manage and create tar files.
We will cover how to:
- Create a tar file with no compression
- Untar an uncompressed tar file
- Create a gzipped tar file
- Untar a gzipped tar file
- Create a bzipped tar file
- Untar a bzipeed tar file
- Listing the contents of a tar file
- Extracting the files to a specific directory
tar cvf tar-file.tar directory/
2. Untar an uncompressed tar file
tar xvf tar-file.tar
3. Create a gzipped tar file
tar cvzf tar-file.tar.gz /directory
4. Untar a gzipped tar file
tar xvzf tar-file.tar.gz
5. Create a bzipped tar file
tar cvjf tar-file.tar.bz /directory
6. Untar a bzipeed tar file
tar xvjf tar-file.tar.bz
7. Listing the contents of a tar file
tar tvf tar-file.tar
For uncompressed tar file
tar tvfz tar-file.tar
For gzipped tar files
tar tvfj tar-file.tar
For jzipped tar files
8. Extracting the files to a specific directory
tar xvf -C tmp/som/other/directory tar-file.tar.gz
For uncompressed tar files
tar xvzf -C tmp/som/other/directory tar-file.tar.gz
For gzipped tar files
tar xvjf -C tmp/som/other/directory tar-file.tar.gz
For jzipped tar files
The options used
- -c
- create a new archive
- -v
- verbosely list files processed
- -f
- use archive file or device ARCHIVE
- -x
- eXtract the file
- -z
- --gzip, --gunzip --ungzip
- -j
- --bzip2
- -C
- change to directory DIR
No comments:
Post a Comment