📚 College Credit Guide ✓ UPI Study 🕐 8 min read

How Do You Back Up and Compress Files in Linux

This article explains how rsync backs up changed files and how tar packages folders with compression for portable Linux archives.

US
UPI Study Team Member
📅 July 24, 2026
📖 8 min read
US
About the Author
The UPI Study team works directly with students on credit transfer, degree planning, and course selection. We've helped thousands of students figure out what counts toward their degree and how to finish faster without paying more than they have to. This post is written the way we'd explain it to you directly.
🦉

Back up with rsync, then package with tar when you need one file you can move, store, or share. That is the clean answer to how do you back up and compress files in Linux. rsync copies only changed data, while tar bundles files and directories into one archive, and compression tools like gzip or xz shrink that bundle. That split matters because backups and archives solve different problems. A backup job protects your working copy, keeps permissions and timestamps, and can sync to another disk or a remote server over SSH. An archive job makes a single portable file for submission, storage, or long-term snapshots. If you mix them up, you can end up with a giant folder copy that wastes space or a compressed file that you cannot restore cleanly. Students usually hit this problem fast. One missed lab folder, one broken USB drive, one final project saved in three random places. Linux gives you better tools than drag-and-drop copying, but you need to know which one does which job. rsync handles routine backups with speed and precision. tar handles packaging. Compression sits on top of tar, not beside it. Once you see that structure, the whole process gets a lot less confusing, and your files stop living on borrowed time.

Close-up of colorful programming code on a blurred computer monitor — UPI Study

How Do Rsync Backups Work in Linux?

rsync backs up files by copying only what changed, so a 10 GB folder with 200 MB of edits moves fast instead of wasting time on the full 10 GB. It also keeps permissions, timestamps, symlinks, and directory structure, which matters when you want the copy to behave like the original after a restore.

That is why rsync feels smarter than plain copy commands. If you run it every night at 2:00 a.m., it compares the source and destination, then sends just the differences. You can back up a folder on the same machine, another drive, or a remote server over SSH. A lot of students like that because they can sync homework to a laptop, a desktop, and a home server without juggling three separate file copies.

The catch: rsync gives you a live mirror, not a frozen time capsule. If you delete a file in the source and run rsync with the wrong flags, the deletion can follow it to the backup, which is useful for mirroring but risky if you meant to keep old versions.

That downside is why I trust rsync for routine backups and not for every preservation job. It shines when you want a current copy of a 1 TB photo folder or a semester project directory that changes every week. It does not create a single archive file by itself, so it does not solve the “send this one file to someone” problem. For that, tar steps in later. If you want a clean start, an Introduction to Linux course usually teaches these commands in the first chunk, because they show up everywhere.

Which Rsync Options Should You Use?

Rsync gets powerful fast, but 6 or 7 flags cover most student backups. The wrong one can wipe a folder, skip permissions, or hide progress on a 40 GB copy, so the choice matters.

Reality check: A backup command with no dry run is a gamble, and rsync will not stop you from making a bad choice. Pair it with a test copy and a 10-second sanity check.

If you want more Linux basics alongside backup commands, Introduction to Operating Systems fits well because file systems, paths, and permissions all show up here.

Introduction To Linux UPI Study Course

Learn Introduction To Linux Online for College Credit

This is one topic inside the full Introduction To Linux course on UPI Study — a self-paced, online class that earns real college credit. Credits are ACE and NCCRS evaluated and transfer to partner colleges across the US and Canada. Courses start at $250 with no deadlines and lifetime access.

Browse Introduction To Linux →

How Do Tar Archives and Compression Fit Together?

tar works like a packing box, and compression works like a vacuum seal. First tar gathers files and directories into one archive, then gzip, bzip2, or xz shrink that archive so it takes less space. A folder with 500 small files can become one .tar file, then one .tar.gz, .tar.bz2, or .tar.xz file after compression.

That order matters because tar handles structure, not size reduction. It keeps the directory tree intact, which makes restore work cleaner than dragging loose files out of a zip pile. gzip usually gives fast compression and fast decompression. bzip2 often compresses a bit more but moves slower. xz usually squeezes hardest, which helps for long-term storage, but it can take longer on older laptops or cheap cloud servers.

What this means: tar gives you one neat package, and compression makes that package smaller. A 2 GB source folder might turn into a 700 MB archive with gzip or an even smaller xz file, depending on the file types.

Tar shines when you want a portable snapshot for a class upload, a project handoff, or a backup you plan to store for 6 months or longer. It also works well when you need one file instead of 3,000 tiny ones, because copy tools and upload forms handle single archives more cleanly. I prefer tar for submission packages and rsync for live backups; that split saves me from sloppy habits. If you want a broader technical base, an Introduction to Networking course helps when you later move archives over SSH or across a campus server.

Should You Use Rsync Or Tar First?

Use rsync first when you want an up-to-date backup, and use tar first when you want one portable file. rsync watches change over time, while tar freezes a folder at a single moment, which makes them different tools even though people lump them together. A 50 GB research folder and a 200 MB homework folder need different treatment, and that choice saves time and pain.

Bottom line: rsync fits the backup layer, and tar fits the packaging layer. If you try to replace one with the other, you lose something: tar does not track incremental changes like rsync, and rsync does not hand you a compressed archive you can email or submit as one file.

You can combine them in a solid workflow. First run rsync to keep a mirror on another drive or server. Then use tar on the source folder or on the mirrored copy when you need a shareable snapshot, such as a final project or a portfolio bundle. That gives you two nice things at once: a current backup and a compact archive.

I think students get into trouble when they force tar to act like a backup system or treat rsync like a zip button. That habit creates confusion during restore day, which is exactly when you want boring, predictable tools. If the task is everyday protection, pick rsync. If the task is long-term storage or submission, pick tar with compression. The line stays pretty clean once you stop asking one command to do both jobs.

What Backup Workflow Should Students Follow?

A student in an Introduction to Linux online course might keep homework, lab files, and a final project in one folder tree, then back it up before submitting a portfolio for an NCCRS-credit review. That setup gets messy fast if the work lives on a laptop, a USB drive, and a cloud folder at the same time. A simple 4-step process saves hours later: make a mirror with rsync, test it, package the final version with tar, then store copies in 2 places. I like this workflow because it stays boring, and boring protects grades.

Worth knowing: A portable archive helps when a professor wants a single submission file, but a mirror helps when your laptop dies 2 days before a deadline.

A real student at a community college can feel this difference in one week. Suppose your Linux lab folder holds 18 assignments, 6 screenshots, and a final shell script. rsync keeps the working set current after each lab, while tar makes a clean end-of-term bundle you can submit or archive. That mix beats random desktop copying every time, and it keeps your work from getting lost in “final_final2” chaos. If you want a structured place to study the command line while you practice, the Introduction to Linux course page gives the same kind of hands-on setup students need.

Frequently Asked Questions about Linux Backups

Final Thoughts on Linux Backups

Linux backup work gets easier once you split the job into two parts. rsync protects your active files by copying changes, and tar turns a folder into one portable archive with compression on top. That split sounds small, but it changes how you think about your data. You stop treating every copy like the same thing. A good habit beats a fancy command. Run rsync often, keep one mirror on a second drive or server, and make a tar.gz or tar.xz archive when you need a snapshot for sharing or storage. That covers the three common cases: daily backup, final submission, and long-term keeping. If you skip the test run, you invite trouble. If you skip the second copy, you gamble with your work. Students usually get burned by the same few mistakes: backing up the wrong folder, forgetting permissions, or trusting one USB stick for everything. None of those errors needs a dramatic fix. They need a calm process and a little repetition. That is the real skill here, not memorizing a dozen flags. Start with one folder, one dry run, and one archive. Then repeat it until the commands feel normal. Your future self will thank you when a deadline lands on a bad week and your files still show up exactly where they should.

How UPI Study credits actually work

Ready to Earn College Credit?

ACE & NCCRS approved · Self-paced · Transfer to colleges · $250/course or $99/month

More on Introduction To Linux
© UPI Study. This article and its educational content are solely owned by UPI Study and licensed under CC BY-NC-ND 4.0. It is not free to reuse or modify. Any citation must credit UPI Study with a direct link to this page.