`
If you find these tutorials useful, Please consider making a donation.

TheFrugalComputerLinuxLogo.png
TheFrugalComputerGuy.png
Linux Command Line 15
backup/archive







Linux Command Line (46) gzip

gzip is used to compress or zip a file that you want to use less disk space to move to an archive/backup device.

When a file is gzipped, the file is moved to the gzip filename, unless the "k" for keep option is used.

zcat is used to cat a gzipped file and zgrep can be used to grep a gzipped file

When a directory is gzipped, each file in that directory is gzipped (not the directory itself).

To gzip multiple files into a single the tar command should be used (The tar command will be shown in the next video).





 






Linux Command Line (47) tar pt1

tar is short for tape archive and a tar file can hold a group of files and directories as a backup and the single file can be moved to a backup or archive device.

The tar file is slightly different than the other Linux commands we've looked at in this tutorial series, the dash before the options is optional for the tar command and the new destination name is before the existing file names. There are reasons that make a lot of sense for this, but it is slightly different.

The video shows how to create a tar file, list the files in a tar file and then extract the files in a tar file.





 






Linux Command Line (48) tar pt2

We pick up from where we left off in the last video and we look at how extracting a tar file a second time will overwrite any changes made to files in the tar file, but if we use the k for keep option, only files that were deleted will be extracted again. We can also extract a single file from a tar file.

We also look at how to extract a tar file into a different directory and how to work with absolute paths when creating and extracting far files.

We then look at what happens when we add a file to an existing tar file and how it keeps both versions and how to extract a specific occurrence of a file with multiple versions in a tar file.





 






Linux Command Line (49) bzip2, xz, zip tar files

bzip2 is a compression method that can compress files to a smaller compressed file size than gzip, but may take longer to run. xz is another compression method that can create compressed files smaller than bzip2, but may take longer than bzip2 to run.

We can create a tar file and compress it in a single command by adding the "z" option to the tar command, to zip a tar file with the file with gzip compression. Adding a "j" option to the tar command will zip the file with bzip2 compression and adding the "J" option will zip the tar file using the xz compression method.

Which compression method is best depends on what is being archived and zipped. Files that are already compressed and very small files, will show less differences between the 3 compression methods. Very large uncompressed files will show more more differences with the compressed archive file size and the time it takes to create that archive file.





 






Linux Command Line (50) zip and 7zip

zip is another way we can archive files using the Linux command line and we look a the basics for creating a zip file, viewing what is in a zip file and then how to unzip a zip file.

This video also shows that 7zip can be used to archive files using the Linux command line. We look at the basics for creating a 7zip file, viewing what is in a 7zip file and how to extract a 7zip file.





 






Linux Command Line (51) rsync pt1

rsync stands for remote sync and can be used to sync files from one computer to another, but rsync can also be used to sync files from one directory to another.

The rsync command is similar to cp (the copy command) with more features. In this video we see how to copy a single file with the rsync command and we look at how to copy a directory (both the entire directory and then just the content in that directory) to another directory using the rsync command.





 






Linux Command Line (52) rsync pt2

In this video, we learn how to sync directories with the rsync command (in rsync pt1, we just copied files with the rsync command).

We then look at how to sync files to and from another computer using the rsync command.