Backup OBS Studio Profiles on Linux with Bash
This article provides a straightforward guide to automating the backup of your OBS Studio profiles and configurations on a Linux system. You will learn where OBS stores its settings, how to write a custom Bash script to compress and save these files, and how to schedule the script to run automatically using Cron.
Step 1: Locate Your OBS Studio Configurations
On Linux, OBS Studio stores its profiles, scene collections, and general settings in a specific configuration folder. The location depends on how you installed the application:
- Standard Package (APT, Pacman, PPA):
~/.config/obs-studio/ - Flatpak:
~/.var/app/com.obsproject.Studio/config/obs-studio/
The custom script below is configured for the standard package path by default, but you can easily modify it for Flatpak installations.
Step 2: Create the Bash Script
Create a new file named backup_obs.sh in your preferred
directory (for example, your home directory or a custom scripts
folder).
nano ~/backup_obs.shPaste the following script into the file:
#!/bin/bash
# --- CONFIGURATION ---
# Path where the backups will be saved
BACKUP_DIR="$HOME/Backups/OBS"
# Source path for standard OBS Studio installation
SOURCE_DIR="$HOME/.config/obs-studio"
# UNCOMMENT the line below if you are using the Flatpak version of OBS
# SOURCE_DIR="$HOME/.var/app/com.obsproject.Studio/config/obs-studio"
# Timestamp format (YYYYMMDD_HHMMSS)
DATE=$(date +%Y%m%d_%H%M%S)
BACKUP_FILE="$BACKUP_DIR/obs_backup_$DATE.tar.gz"
# ---------------------
# Create the backup destination folder if it doesn't exist
mkdir -p "$BACKUP_DIR"
# Verify if the source directory exists
if [ -d "$SOURCE_DIR" ]; then
# Create a compressed tarball of the configuration folder
tar -czf "$BACKUP_FILE" -C "$(dirname "$SOURCE_DIR")" "$(basename "$SOURCE_DIR")"
echo "Success: OBS Studio profiles backed up to $BACKUP_FILE"
else
echo "Error: OBS Studio configuration directory not found at $SOURCE_DIR"
exit 1
fi
# Optional: Keep only the last 30 days of backups to save disk space
find "$BACKUP_DIR" -type f -name "obs_backup_*.tar.gz" -mtime +30 -deleteSave and close the file (in nano, press Ctrl+O,
Enter, then Ctrl+X).
Step 3: Make the Script Executable
Before running the script, you must grant it execution permissions. Run the following command in your terminal:
chmod +x ~/backup_obs.shYou can test the script manually by running:
./backup_obs.shVerify that a .tar.gz archive has been created in your
designated backup folder (e.g., ~/Backups/OBS).
Step 4: Automate the Backup with Cron
To ensure your profiles are backed up without manual intervention, schedule the script using the Cron daemon.
- Open your user crontab configuration:
crontab -e- Add a line at the bottom of the file to schedule the backup. For example, to run the script every day at 2:00 AM, add:
0 2 * * * /bin/bash /home/your_username/backup_obs.sh
(Note: Replace your_username with your actual Linux
username).
- Save and exit. The system will now automatically run the script and maintain a rolling 30-day archive of your OBS Studio profiles.