managing dotfiles with gnu stow - GNU/Linux
xero
it's been said of every console user: "you are your dotfiles".

i manage mine with gnu stow, a free, portable, lightweight symlink farm manager. this allows me to keep a versioned directory of all my config files that are virtually linked into place via a single command. this makes sharing these files among many users (root) and computers super simple. and does not clutter your home directory with version control files.

installing
stow is available for all gnu/linux and most other unix like distributions via your package manager.

Code:
sudo pacman -S stow
Code:
sudo apt-get install stow
Code:
brew install stow

how it works
by default the stow command will create symlinks for files in the parent directory of where you execute the command. so my dotfiles setup assumes this repo is located in the root of your home directory ~/dotfiles. and all stow commands should be executed in that directory. otherwise you'll need to use the -d flag with the repo directory location.

the rest of this article will directly corrilate to my dotfiles, they're available here: http://git.io/.files

to install most of my configs you execute the stow command with the folder name as the only argument.

to install herbstluft theme use the command:

Code:
stow herbstluftwm

this will symlink files to ~/.config/herbstluftwm and various other places. (note the folder structure on the herbstluftwm directory)

but you can override the default behavior and symlink files to another location with the -t (target) argument flag.

to install the ryu-login you need to execute the command:

Code:
stow -t / ryu-login

this will symlink the file to /etc/issue.

note: stow can only create a symlink if a config file does not already exist. if a default file was created upon program installation you must delete it first before you can install a new one with stow. this does not apply to directories, only files.

tl;dr
navigate to your home directory

Code:
cd ~

clone the repo:

Code:
git clone https://github.com/xero/dotfiles.git

enter the dotfiles directory

Code:
cd dotfiles

install the zsh settings

Code:
stow zsh

install the root zsh settings

Code:
sudo stow zsh-root -t /root

install awesomewm theme

Code:
stow awesome

uninstall awesome theme

Code:
stow -D awesome

install herbstluftwm

Code:
stow herbstluftwm

i hope this gives you some ideas for managing your own dotfiles!
yrmt
That looks nice, thanks for making the tutorial.
z3bra
Nice howto ! That's the type of content that would fit nicely in the diary
BANGARANG, MOTHERFUCKER
dami0
I know I sound like a dick; but why not Git or CVS?
z3bra
git : version your dotfiles, save them online, as well as previous copies.
stow: symlink file manager, you can see it as a smart way to deploy your versionned dotfiles

so basically:

Code:
git clone git://url.to/my-dotfiles.git ~/etc
cd ~/etc
stow file

(I don't know the syntax or whatsover, just explaining how you could use it)
BANGARANG, MOTHERFUCKER
xero
you got it z3bra! i keep my dotfile in a git repo (http://git.io/.files) then *IN* that repo i use the stow command to link the files into place. it keeps your home directory cleaner (no version control files in the root) and all the dotfiles in one place. so when i make changes to say my zsh aliases, i don't have to copy the file into the repo. i just update the file in the repo and the symlink makes the change virtually in place.
dami0
Oh that actually does make sense. Might check it out soon, thanks xero!
AlexTes
This guide just brought my dotfiles set-up to a much better place.
JoshuaRLi
Long time GNU Stow user here, and have been recently working on a simpler replacement called sym. source is here and some rationale and usage can be found in the readme. It requires python 3.6+, stdlib only, and am planning on using it as a reference implementation for a rewrite in some compiled language in the future when I have more time.

Let me know what you guys think. I migrated my dotfiles installation to it like this, main benefits being:
  • you can specify more than one source directory so as to invoke the tool only once, as opposed to stow multiple times
  • a cleaner default command line invocation (e.g.
  • source directory location can be arbitrary and not limited to 1 directory level (stow will complain about "slashes not permitted in package names")
  • better cleanup (will remove empty dirs resulting from symlink removal)
  • 100-ish LoC, clean and readable
JoshuaRLi
There's one feature I'll be adding soon - the ability to specify repeatable --include and --exclude glob patterns (or, probably regexes) to compliment the default blacklist. If there are any other feature requests or criticisms, do let me know, but regarding the former I'd like to keep sym as simple as possible for the use case at hand.




Members  |  Stats  |  Night Mode