Worth remembering

From Wurst-Wasser.net
Jump to navigation Jump to search


  • Concatenate all files in (sub-)folders and prefix with filename:
find . -type f -printf \\n=====NEW\ FILE:\ %f====\\n -exec cat {} \; > ../onefile.txt



set number
set tabstop=4
set shiftwidth=4

Append to your files

# vim:tabstop=4:shiftwidth=4:autoindent

Instead of rsync

Copying a remote folder to a local disk

ssh root@OLDSYSTEM "cd /; tar cf - etc" |tar xvf -

Creating a local tar from a remote folder

ssh dtr tar czf - /mnt/boot > mnt_boot.tgz

Optional: --one-file-system # not sure this is correct, maybe try this:

ssh dtr tar czf --exclude /mnt/var --exclude /mnt/boot - /mnt > mnt_root.tgz

Creating a local dump from a remote folder

ssh dtr "/sbin/dump -0a -b 256 -z9 -f - /dev/sdc3" > mnt_root.dump