Lesson 15 — Basic Backup, Archives & File Transfer
cp + rsync + tar + gzip + scp
Linux administrators move and protect data all the time. This lesson teaches a clean workflow using cp for simple copies, rsync for smarter synchronized backups, tar for archiving files into one bundle, gzip for compression, and scp for secure file transfer between systems.
Good data handling follows a simple pattern: decide whether you need a copy, a sync, an archive, or a transfer → run the correct command → verify the result.
Copy files safely, back up folders with rsync, create archives with tar, compress files with gzip, and securely transfer files with scp.
Lesson Objectives
By the end of this lesson
- Copy files and directories with
cp - Use
rsyncfor efficient backup-style syncing - Create archives with
tar - Compress files with
gzip - Transfer files between systems with
scp
Why this matters
- Admins need safe ways to protect important data
- Copying and syncing are not the same thing
- Archives make many files easier to move and store
- Secure file transfer is part of real support work
1) Copy Files with cp
Copy one file
Use cp when you want a straightforward copy of a file.
Copy a directory
Use the recursive option to copy a whole directory and its contents.
What cp is good for
- Quick one-time copies
- Simple local backups
- Duplicating a file before editing it
cp is simple, but simple is not always enough. For repeated backups or folder sync jobs, rsync is often the stronger tool.
2) Sync Smarter with rsync
rsync is commonly used for backup-style file synchronization because it is efficient and flexible.
Basic sync example
This copies files while preserving useful metadata and showing what is being transferred.
Why rsync is stronger
- Good for repeated backups
- Efficient for syncing folders
- Often avoids copying everything again unnecessarily
Common beginner mistake
Pay attention to trailing slashes. In many cases, project/ and project do not mean exactly the same thing in rsync.
3) Create Archives with tar
tar bundles many files into one archive, which makes backup and transfer easier.
Create an archive
This creates an archive file named project.tar.
Extract an archive
This extracts the contents of the archive.
Why tar matters
- Many files become one manageable archive
- Archives are easier to move or store
- Common in Linux backups and deployments
4) Compress Files with gzip
gzip is used to compress files and reduce storage or transfer size.
Compress a file
This usually turns project.tar into project.tar.gz.
Decompress a file
This restores the compressed file back to its uncompressed form.
Common workflow
This is a common beginner-friendly way to archive first and compress second.
5) Transfer Files Securely with scp
scp securely copies files between systems over SSH.
Copy local file to remote host
This sends the file to a remote system.
Copy remote file to local system
This pulls the remote file into your current local directory.
Why scp matters
- Uses secure SSH transport
- Good for moving backups or logs
- Common in admin support tasks
After any copy, backup, archive, or transfer, verify the result. A “successful command” is not enough unless the data is actually where it should be.
6) Fast Troubleshooting Pattern
- Decide whether you need a simple copy, a sync, an archive, or a transfer
- Use the correct command for that goal
- Verify the copied, archived, or transferred data exists
- Do not assume success without checking
Practical — Back Up and Transfer a Project Folder
This practical teaches a real support workflow instead of random command memorization.
Practical Task
- Make a simple copy of a file with
cp - Sync a folder with
rsync - Create an archive with
tar - Compress the archive with
gzip - Write how you would securely send it using
scp
Walkthrough
The point is not to memorize a giant list. The point is to know which tool fits which job and verify the result each time.
Example Ticket Note
Created local backup copy of user file, synchronized project directory with rsync, archived data with tar, compressed archive with gzip, and prepared secure transfer command using scp.
Write Your Observation
Use a simple note like a junior admin would write.
Mini Knowledge Check
Score 75% or higher to unlock the next lesson link. Your score is saved on this browser.
1) Which command is best for a simple one-time file copy?
2) What is a strong reason to use rsync?
3) Which command creates an archive file?
4) What is the strongest lesson habit here?
Next Lesson
Tip: update the next lesson link when your page exists.