Worth remembering: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(→vi(m)) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
= [[bash]]-magic = | |||
* Concatenate all files in (sub-)folders and prefix with filename: | |||
<syntaxhighlight lang="bash"> | |||
find . -type f -printf \\n=====NEW\ FILE:\ %f====\\n -exec cat {} \; > ../onefile.txt | |||
</syntaxhighlight> | |||
= [[vi]](m) = | = [[vi]](m) = | ||
== ~/.vimrc == | == ~/.vimrc == | ||
Line 9: | Line 15: | ||
= Instead of rsync = | = Instead of rsync = | ||
Copying a remote folder to a local disk | ==Copying a remote folder to a local disk== | ||
ssh root@OLDSYSTEM "cd /; tar cf - etc" |tar xvf - | ssh root@OLDSYSTEM "cd /; tar cf - etc" |tar xvf - | ||
Creating a local tar from a remote folder | ==Creating a local tar from a remote folder== | ||
ssh dtr tar czf - /mnt/boot > mnt_boot.tgz | ssh dtr tar czf - /mnt/boot > mnt_boot.tgz | ||
Optional: --one-file-system # not sure this is correct, maybe try this: | 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 | ssh dtr tar czf --exclude /mnt/var --exclude /mnt/boot - /mnt > mnt_root.tgz | ||
Creating a local dump from a remote folder | ==Creating a local dump from a remote folder== | ||
ssh dtr "/sbin/dump -0a -b 256 -z9 -f - /dev/sdc3" > mnt_root.dump | ssh dtr "/sbin/dump -0a -b 256 -z9 -f - /dev/sdc3" > mnt_root.dump | ||
[[Category:Linux]] | [[Category:Linux]] |
Latest revision as of 17:02, 8 March 2024
bash-magic
- Concatenate all files in (sub-)folders and prefix with filename:
find . -type f -printf \\n=====NEW\ FILE:\ %f====\\n -exec cat {} \; > ../onefile.txt
vi(m)
~/.vimrc
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