To Compress A File Or Directory
Log into your Linux server.
Locate the files or directory that you want to compress
Type the following commands: For compressing a file;
"tar czvf name_of_compressed_file.gz /location_of_the_file_you_are_compressing.
Or if you are compressing a directory
"tar czvf name_of_compressed_file.gz /location_of_the_directory_you_are_compressing.
The attributes are what tell the program how to handle the compress;
- -z: Compress archive using the gzip program
- -c: Create the archive
- -v: Verbose | display progress while creating the archive
- -f: Archive the File or Directory name
Extracting A File Or Directory
Type the following command for extracting a file;
"tar czvf name_of_compressed_file.gz /location_of_the_file_you_are_extracting.
Or if you are uncompressing a directory
"tar xzvf name_of_compressed_file.gz /location_of_the_directory_you_are_extracting.
The attributes are what tell the program how to handle the compress;
- -z: Compress archive using the gzip program
- -x: Extract the archive
- -v: Verbose | display progress while creating the archive
- -f: Archive the File or Directory name