Useful options of rsync
Classified in : Homepage, Debian, Command line, To remember
rsync is often used to back up systems, with options such as:
-a --archive
- recurse and preserve usual attributes: symlinks, devices and special files, user and groups ownership, permissions and times;
-H --hard-links
- detect and preserve hard links;
-A --acls
- preserve ACLs, if you use them;
-X --xattrs
- preserve extended attributes, if you use them.
In addition to these common options, rsync has plenty others, so everyone has his own recipe, but I would like to share two useful options I discovered.
Wrapper to use su as sudo (or sudo as su)
Classified in : Homepage, Debian, Command line
The problem
Some programs require root privileges for part of their work: most notably Debian building tools such as dpkg-buildpackage or pdebuild. So, several command can be used to obtain real or fake root privileges: su, sudo, fakeroot, etc. Among them, su is quite distinct, because it only takes a quoted command to pass it to a shell. That is why its interface is completely incompatible with the others':
$ su -c "pbuilder --build package.dsc" $ sudo pbuild --build package.dsc
This is annoying when real root privileges are needed, for instance by pbuilder, a tool to build Debian packages inside a minimal chroot. Indeed, in such a case I only know one command to obtain the root privileges, sudo, and some people (read: me) prefer using su.