click below
click below
Normal Size Small Size show me how
tar and gzip
Archive and compression
| Question | Answer |
|---|---|
| Create a new archive | tar -c |
| Verbose - list files being written | tar -v |
| Specify the file to create or unpack | tar -f |
| Compress/decompress a file using gzip | tar -z |
| Extract the files | tar -x |
| Compress/decompress a file using bzip2 | tar -j |
| Change to a specified directory | tar -C |
| List the contents of an archive | tar -t |
| Backup and compress the /home directory to /root/home_backup.tar.gz | tar -cvzf /root/home/backup.tar.gz /home |
| Extract and decompress /root/home/backup.tar.gz to the /home directory | tar -xvzf /root/home/backup.tar.gz /home |
| Write to standard output | gzip/gunzip - c |
| Decompress a file using gunzip | gunzip -d |
| Recursively compress/decompress all files in directories/subdirectories | gzip/gunzip - r |
| Suppress warnings with gzip | gzip -q |
| Show gzip help screen | gzip -h |
| Show gzip Licence | gzip -L |
| Save the original file name and time stamp with gzip | gzip -N |
| Omit saving original file and time stamp | gzip -n |
| Check compressed file for integrity | gzip -t |
| Force compression/decompression of file even if it has multiple links or the corresponding file already exists | gzip/gunzip -f |
| Keep original file unchanged using bzip2 | bzip2 -k |
| Append newer or updated files on an existing tar file (overwrite) | tar -u |
| Append the newer files to the end of an existing tar file | tar -r |