Skip to content

Instantly share code, notes, and snippets.

@tovbinm
Created May 1, 2011 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tovbinm/950514 to your computer and use it in GitHub Desktop.
Save tovbinm/950514 to your computer and use it in GitHub Desktop.
File System manipulations
On source:
dd if=/dev/sda | gzip -cf | nc <destination-system-ip> <port>
On destination:
nc -l -p <port> | gzip –dfc | dd of=/dev/sda
(http://conshell.net/wiki/index.php/Linux_P2V)
ls <folder> | xargs -n 100 du -k | sort -n | tail -n <number_of_files> | awk '{if ($1 > <desired_size>) print $2}'
ls -d *.<old_extension> | sed 's/\(.*\).<old_extension>$/mv "&" "\1.<new_extension>"/' | sh
echo blahblah | sudo tee /somefile
rm -rf `find ./<you folder> -type d -name <criteria>`
find /<your folder>* -mtime +X -exec rm {} -f \;
rsync -r --partial --progress --rsh=ssh user@server:/sorce/ /dest/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment