# What files and directories can be excluded from a backup of the home directory?

Duplicity does already a great job of making efficient backups, but I want still to minimize the amount of files being back-upped.

What files or directories can be excluded in a home directory? Please name these explicitly, wildcards allowed, paths are relative to the home directory.

-
Great question! I find it useful to analyze my home directory (the one I back up) using Disk Usage Analyzer and make sure to ignore anything that shows up in the top and which I don't mind losing in case of data loss. For instance, I'm not interested in backing up my src directory containing local copies of source code available online. –  joelpet Jan 12 '14 at 17:58

Most of these files and directories are recreated if missing. It lowers the startup time of an application (Firefox extensions cache), is used to indicate locks (.gksu.lock), contains session-specific information (e.g. ID of dbus session). Recent documents changes frequently and is generally not that sensible to backup.

These directories may be excluded:

.gvfs                           # contains mounted file systems?
.Private                        # contains the actual encrypted home directory
.dbus                           # session-specific
.cache
.Trash                          # do I need to say more?
.local/share/Trash
.cddb                           # cached info about audio CDs
.aptitude                       # cached packages lists


Flash-specific:

.adobe                          # Cache for flash, maybe others?
.macromedia   # except for Flash persistence, there is no reason to keep this


Files:

.xsession-errors            # contains errors from the current graphical session
.recently-used              # recently used files
.recently-used.xbel
.thumbnails
.Xauthority                 # session-specific
.ICEauthority
.gksu.lock
.pulse  # directory
.esd_auth


KDE specific:

.kde/share/apps/RecentDocuments # Recent documents on KDE
.kde/share/apps/klipper         # Contains a history of the Klipper clipboard (KDE)
.kde/share/apps/okular/docdata  # you will loose saved scrolling positions of PDFs
.kde/share/apps/gwenview/recentfolders
.kde/share/apps/kmess/displaypics  # cached other users' profile pics
.kde/share/apps/kmess/customemoticons  # cached emoticons of others


.mozilla/firefox/*/Cache
.mozilla/firefox/*/minidumps    # in case Fx crashes dumps will be stored in this
.mozilla/firefox/*/.parentlock       # session-specific
.mozilla/firefox/*/urlclassifier3.sqlite  # phishing database, recreated
.mozilla/firefox/*/blocklist.xml   # blacklisted extensions
.mozilla/firefox/*/extensions.sqlite  # extension database, recreated on startup
.mozilla/firefox/*/extensions.sqlite-journal
.mozilla/firefox/*/extensions.rdf
.mozilla/firefox/*/extensions.ini
.mozilla/firefox/*/extensions.cache
.mozilla/firefox/*/XUL.mfasl     # cached UI data, recreated
.mozilla/firefox/*/XPC.mfasl
.mozilla/firefox/*/xpti.dat
.mozilla/firefox/*/compreg.dat


Opera-specific (related question on Superuser.com: Is documentation available on files and directories in the Opera profile folder?):

.opera/temporary_downloads
.opera/cache
.opera/thumbnails
.opera/opcache
.opera/icons
.opera/application_cache
.opera/widgets/*/cache
.opera/lock

.komodoedit/*/codeintel/db
.komodoedit/*/host-*/*/codeintel
.komodoedit/*/XRE/Cache
.komodoedit/*/XRE/.activatestate/komodo edit/Crash Reports
.komodoedit/*/XRE/.activatestate/komodo edit/*/Cache
.komodoedit/*/XRE/.activatestate/komodo edit/*/minidump
.komodoedit/*/XRE/.parentlock
.komodoedit/*/XRE/extensions.rdf
.komodoedit/*/XRE/extensions.ini
.komodoedit/*/XRE/extensions.cache
.komodoedit/*/XRE/XPC.mfasl
.komodoedit/*/XRE/XUL.mfasl
.komodoedit/*/XRE/xpti.dat
.komodoedit/*/XRE/pluginreg.dat
.komodoedit/*/XRE/compreg.dat
.komodoedit/*/XRE/*.sqlite-journal
.komodoedit/*/pystdout.log
.komodoedit/*/pystderr.log
.komodoedit/*/history.sqlite.bak
.komodoedit/*/running.lock
.komodoedit/*/mutex.lock
.komodoedit/*/*.xmlc
.komodoedit/*/startup-env.tmp
.komoeoedit/*/commandments.fifo
.komoeoedit/*/history.sqlite


GnuPG:

.gnupg/rnd
.gnupg/random_seed
.gnupg/.#*
.gnupg/*.lock
.gnupg/gpg-agent-info-*


.config/google-chrome/Default/Local Storage


Other apps:

.pulse/icons                  # Pidgin
.java/deployment/cache        # Cached applets
.icedteaplugin
.icedtea
.gnome2/epiphany/favicon_cache

-
awesome answer! –  MountainX Dec 5 '11 at 4:05
I created a gist You can download the ignorelist with wget https://gist.githubusercontent.com/rubo77/8ffaadbc58ab099d2bc3/raw/099c3e350a92e‌​7dcb3ef406c10d4b2740151c22f/ignorelist -O /var/tmp/ignorelist Then start the rsync with rsync -a --progress --exclude-from=/var/tmp/ignorelist /home/$USER/ /media/$USER/linuxbackup/home/ see askubuntu.com/a/545676/34298 –  rubo77 Nov 4 '14 at 18:05

Good question. I like these -- where we can gather community input/lists and cherry pick relevant stuff. Here's my .exclude file. I feed this file to rsync as an --exclude-file= parameter in multiple scripts (which you can also do with duplicity). Note that the question implies "what do you want/need to save". For example, I backup my complete .mozilla DIR as it contains multiple profiles and tweaks and it's easier to dump it back on disk as a whole. Also implied in my config: I do a lot of "build from the ground up installs" for testing. So I have a clonezilla image of a known-good-clean-base install, and I add in my personal (/home) data stored on USB after it's on disk; sometimes selectively, sometimes as a whole.

# Filename: admin/dotfiles/exclude
# Create Date: 20110307-23:36HRS

.cache
.aptitude
.compiz # no settings here; processes
.dbus
.dropbox # don't try to restore and reinitialize either of
.dropbox-dist # these DIRs; very messy results can happen
.elegant-gnome-backup
.fontconfig
.gnome2_private # MT; at least on my system
.pulse*
.gconfd
.gvfs
.macromedia
.local/share/Trash/
.thumbnails
Dropbox/ # recreated on re-initialization
Public/
Music/
Templates/ # stored on U1
Ubuntu One/ # recreated on re-initialization
wdir/iso/
wdir/backups/

-

I've recently been looking at doing this sort of thing, and I've noticed that many of the files in my home directory that I don't want to back up seem to not have group permissions set. If the same holds on other systems, then a likely list of suspects might be obtained with:

find ~ -not -perm -g+r

(Although check the output, because although mine seemed mostly good, my e-mail inbox also appeared on the list, and I don't know how well it will work for others.)

This is particularly appealing to me, because my home directory is encrypted (including filenames), so a manual exclusions list would be a PITA, and instead I should be able to use group permissions to auto-generate an exclusion list.

(I know the thread is old, but I thought this might be useful to someone.)

-
The permission of a file is a bad guide to determine whether a file is needed or not. Private SSH keys for example should have restrictive permissions, but surely you want to backup them. –  Lekensteyn Aug 17 '14 at 9:49