# How to Back Up Your Files in Linux


As a fellow Linux user, I know ensuring your important files stay protected matters. After all, losing years of family photos, creative projects, or work documents feels awful. Thankfully, with some simple Linux terminal commands, you can schedule regular backups so you _never_ lose your files again.

In this beginner's guide, I'll walk through easy-to-use backup options using built-in Linux tools. With just a little terminal work, you can sleep better at night knowing your files stay safe no matter what.

## Why Files Backups Matter

Before diving into the _how_, understanding the _why_ makes these backup tasks meaningful. As someone who cherishes certain files, you likely rely on your Linux machine more than you realize.

Over years of use, your computer stores precious digital aspects of your life - everything from financial records to the 50,000-word novel you've slowly crafted over a decade. Or decades of tax documents you must keep. Without even noticing, you build a digital footprint on your Linux device worth protecting.

And there's always a risk hardware fails unexpectedly. Power surges. Software crashes. Natural disasters. Theft. With so many potential disruptions, backups give you the fail-safe you deserve.

I back up my Linux laptop weekly, knowing one disaster could otherwise make 15 years of files vanish instantly. It brings me peace of mind for barely any effort. You deserve that same ease and reassurance!

## Built-In Backup Tools for Linux Users

The good news? All Linux distributions come equipped with simple terminal commands enabling you to schedule backups automatically. No added software is required.

For most users' needs, the `rsync` and `cron` tools offer an easy built-in solution. Together, they deliver incremental backups to different storage devices however often you define. Let's explore how they work in more detail.

### Understanding the Linux `rsync` Command

The `rsync` terminal program synchronizes source and target directories through incremental file transfers. In plain English, `rsync`:

- Identifies new, modified, or deleted files compared to the last backup
- Copies those changed files efficiently to the backup destination
- Leaves unchanged files alone to save time

This means each backup moves only what's necessary. After the first complete backup, future instances take seconds or minutes by transferring just the differences.

`rsync` even preserves symbolic links, permissions, modification times, ownership, and other metadata. This keeps your backup as faithful as possible to the live source files.

### Automating with `cron` Scheduled Jobs

While `rsync` handles efficient backup transfers, the `cron` scheduling daemon runs tasks at your specified intervals. Together, you can schedule:

- Nightly incremental `rsync` backups
- Weekly full backups
- Offsite cloud copies for redundancy

I run hourly, daily, and weekly backup jobs automatically. Set and forget!

## Step-By-Step Guide to Scheduling Linux Backups

Ready to configure your own recurring Linux file backups? Follow these steps to start safeguarding your data:

### 1\. Choose Your Backup Destination

First, choose where you want to save backup copies. Common destinations include:

- External USB drives
- Attached NAS (Network Attached Storage) devices
- Backup partitions on the Linux device itself
- Remote servers like hosting providers
- Cloud storage services like Google Drive or Dropbox

Ideally, keep local _and_ offsite backups for better redundancy.

### 2\. Connect to That Backup Destination

Next, connect to the backup destination manually to test the path works.

For external USB drives, connect them and note the mount point path:

```typescript
/media/ersu / MyBackupDrive;
```

For remote destinations, connect via SSH or mount networked drives. Verify you access the remote or cloud location by creating/deleting a test file.

Get the remote directory path exactly right. This path goes in your `rsync` command next.

### 3\. Craft Your `rsync` Command

With destinations ready, build the `rsync` command using this template:

```typescript
rsync options source destination
```

For example, a home directory backup to an attached USB might look like:

```typescript
rsync - av / home / user / /media/ersu / MyBackupDrive;
```

Let's break this down:

- `rsync`: The backup program itself
- `-av`: Recommended options `-a` for archive/recursive and `-v` for verbosity
- `/home/user/`: Source files being backed up
- `/media/...`: Destination location

Tweak paths and options as needed.

### 4\. Test Your `rsync` Command

Once your command looks good, test it out! Run your `rsync` line manually in the terminal to confirm it works as expected before scheduling the job.

The first sync may take longer to fully copy the source directory. But subsequent tests should transfer only small changes fast.

Troubleshoot any issues before moving to automation.

### 5\. Create Your `cron` Job

With a working `rsync` command, setting a `cron` job to schedule it takes seconds.

Open the cron table editor:

```typescript
crontab - e;
```

Then paste in your `rsync` command like so, with cron's [interval syntax](https://en.wikipedia.org/wiki/Cron#CRON_expression):

```typescript
0 2 * * * rsync options source destination
# Runs every day at 2 AM
```

Save and exit. Check `cron` logs to validate that scheduled job runs succeed. Enjoy hands-free backups.

> Also read - [**How To Check Disk Space on Linux**](https://developnsolve.com/how-to-check-disk-space-on-linux)

## Protect Your Linux Life with Rsync Backups

While no one _likes_ tedious upkeep tasks, regular Linux backups provide big peace of mind upsides. Following this guide, you can enable them in under an hour.

Knowing your files stay protected should hardware fail makes all those years of digital memories, creative works, and professional docs far safer long term.

What matters most to you on your Linux machine right now?

For me, it's over a decade of photos I'd hate to lose. Configure incrementally `rsync` backups today so _your_ precious data always remains close at hand when you need it most.

