2021-03-31

GNU Stow CLI Command Reference

 31 Mar 2021  Meta Code

GNU Stow CLI Command Reference

Download and extract Stow from the GNU FTP  server:

wget http://ftp.gnu.org/gnu/stow/stow-latest.tar.gz && tar -xvzf stow-latest.tar.gz

Compile the Stow binary (requires Perl):

cd stow-2.3.1
sudo sh configure && make

If an error message about missing Test::Output module, this must be installed using CPAN:

cd # go back to $HOME

sudo cpan

# you may be prompted for default settings, choose [yes]

install Test::Output

exit

After installing the Test::Output module, delete the stow-2.3.1 folder and extract the archive again and rerun the build commands:

rm -rf stow-2.3.1

tar -xvzf stow-latest.tar.gz

cd stow-2.3.1

sudo sh configure && make

Copy binary to PATH:

sudo cp bin/stow  /usr/bin

Verify that Stow’s executable can be run:

stow --version

If an error message is returned that resembles the following:

Can't locate Stow.pm in @INC (you may need to install the Stow module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.30.0 /usr/local/share/perl/5.30.0 /usr/lib/x86_64-linux-gnu/perl5/5.30 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.30 /usr/share/perl/5.30 /usr/local/lib/site_perl /usr/lib/x86_64-linux-gnu/perl-base) at /usr/bin/stow line 463.
BEGIN failed--compilation aborted at /usr/bin/stow line 463.

Then you’ll have to install the Stow Perl module in order to fix this:

sudo cpan install Stow

stow --version

Next, identify source files and structure relative to $HOME directory, for example:

~/.config/audacious/config
~/.gitconfig
~/.config/extensions-sync.json
~/.zshrc

Create central folder for Stow and create package directories:

mkdir ~/stow
cd ~/stow

mkdir audacious
mkdir gnome
mkdir git
mkdir zsh

Next, move (not copy) the files from their original directories into the central location.

Ensure the directory structure each package directory mirrors the structure of the parent directory transparently, for example:

cd ~/stow

mkdir audacious/.config/audacious
mkdir gnome/.config

mv ~/.config/audacious/config  ~/stow/audacious/.config/audacious
mv ~/.config/extensions-sync.json  ~/stow/gnome/.config/extensions-sync.json
mv ~/.gitconfig  ~/stow/git/.gitconfig
mv ~/.zshrc  ~/stow/zsh/.zshrc

Example of file locations after moving:

~/stow/audacious/.config/audacious/config
~/stow/gnome/.config/extensions-sync.json
~/stow/git/.gitconfig
~/stow/zsh/.zshrc

Invoke stow to create symbolic links, for example:

cd ~/stow

stow audacious
stow gnome
stow git
stow zsh

Use Git to keep track of changes to the central Stow directory, for example:

cd ~/stow

git init
git remote add origin https://gitlab.com/oedmarap/stow.git
git add --all
git commit -m "GNU Stow is awesome!"
git push -u origin master
Webmentions & Comments

Copyright © Paramdeo Singh. Built with Jekyll and ❤ in Guyana. All Rights Reserved.

Last Site Build on Tue, 13 Apr 2021 16:55:04 -0400

1MB Club Badge