Here you find a selection of some of my Bash scripts that you may find useful. I wrote them many ago and they are still in use.

Execute a command as another user with: sudox

sudox (sudo for X) is a Bash script that executes commands under X in UNIX and LINUX on behalf of another user using sudo. It provides the necessary privileges using xauth over a pipe. I use it for example to execute firefox as a different user with low privileges.


> sudox -u <other_user> <command>


> sudox -u mynobody firefox

sudox has the same function than the discontinued sux command that was distributed formely as a package in Debian and Ubuntu.

Read more as html/pdf-rendition or download the script.

Incremental encrypted backups with: afio, secbak and secrest

secbak and secrest are scripts that uses afio a cpio replacement for assembling files to an archive. The scripts implements incremental multi-volume backups and restore. Unlike with tar, files are compressed individually and can be optionally encrypted. This makes the archive more robust in case of read errors.

Read more as html/pdf-rendition or download the script.

Publish only sub-trees tagged as: PUBLIC is a Bash script that reconstructs parts of a UNIX or LINUX directory tree using symbolic links. I use it in order to to collect selected assets of my hard disk on a web server. Only files and directories within folders named PUBLIC are published. It uses nested find commands.

Read more as html/pdf-rendition or download the script.

lnr -s is a Bash script which creates symbolic links with the same syntax as the UNIX command ln -s. Unlike ln -s it searches the shortest relative path between the source and destination and creates the link with a relative path. Most of the time symbolic links are very short in distance and used mainly to reduce redundancy. The advantage of relative symbolic links is that whole branches can be moved without breaking links. If you do so, please make sure that branch you want to move does not does not contain relative links pointing outside the moving branch.

Read more as html/pdf-rendition or download the script.