Dot-back is a shell script that copies a user's dot-files to a local, version-controlled directory. This project ensures a known working copy of a dot file matched from a preconfigured list can be kept safe.
I created this project to ensure that I could always roll back to the known-good version whenever I sullied a file. Once a User's home directory ~
has dot .
files present, dot-back.sh
dynamically copies files after detecting the current Operating System type and creates a cron
job to execute the script at a set frequency.
Dot-back has been tested with macOS (11.0.x
) and Ubuntu (20.04.x LTS
).
The script will copy [✔️] and omit [❌] the following directories and files:
File/Directory | Ubuntu | MacOS |
---|---|---|
📄 ~/.bashrc |
✔️ | ✔️ |
📄 ~/.bash_history |
❌ | ❌ |
📄 ~/.bash_logout |
❌ | ❌ |
📄 ~/.bash_profile |
✔️ | ✔️ |
📁 ~/.config/coc |
✔️ | ✔️ |
📁 ~/.config/nvim |
✔️ | ✔️ |
📁 ~/.config/powerline |
✔️ | ✔️ |
📄 ~/.config/starship.toml |
✔️ | ✔️ |
📄 ~/.fzf.bash |
✔️ | ✔️ |
📄 ~/.fzf.zsh |
✔️ | ✔️ |
📄 ~/.NerdTree* |
✔️ | ✔️ |
📄 ~/.ssh* |
❌ | ❌ |
📄 ~/.tmux* |
✔️ | ✔️ |
📄 ~/.tmux* |
✔️ | ✔️ |
📁 ~/.vim |
✔️ | ❌ |
📄 ~/.zshrc |
✔️ | ✔️ |
📄 ~/.zcompdump* |
❌ | ❌ |
📄 ~/.zsh_history |
❌ | ❌ |
⁜ Additional files and directories are excluded in the project's .gitignore
⁜⁜ Symlinks with matching filenames are ignored [Ubuntu only]
- Fork this project
- In the command line,
cd
to the project folder - Execute the script:
$SHELL ./dot-back.sh
- MacOS: If prompted in Terminal, click [ OK ] to allow access.
- Confirm the following:
- The
cron
job was added:crontab -l
- The
.CronSetupDone
file was created:ls ./cron
- The
Use crontab -r
to delete all user created crontab
s, man crontab
for more information.
Edit L23
in ./cron/cron-setup.sh
with your preferred frequency.
Once updated, delete ./cron/.CronSetupDone
and run ./dot-back.sh
.