linux

Free Cached Memory in Linux

Do this only if you know what you are doing!

Switch to Super User
:$ sudo su
To free pagecache
:# sync; echo 1 > /proc/sys/vm/drop_caches
To free dentries and inodes
:# sync; echo 2 > /proc/sys/vm/drop_caches
To free pagecache, dentries and inodes:
:# sync; echo 3 > /proc/sys/vm/drop_caches

Backing up the Bootsector

If you going to play around with Bootloaders, it is wise to make a backup of your bootsector. Use the handy dd tool to make a backup.

dd if=/dev/hda of=bootsector.img bs=512 count=1

Make sure to change the drive device name hda to reflect whatever your system's is.

And to restore

dd if=bootsector.img of=/dev/hda 

Rsync over SSH

rsync is an open source utility that provides fast incremental file transfer. rsync synchronizes directory stucture between two machines. To run rsync over SSH , provide the -e flag in the args.

rsync -ave ssh user@host.com:/home/user/mydropzone/ /home/user/mydropzone

By Default, rsync will not remove files/folders from the destination folder if they were removed on source since last rsync. To remove files/folders that are no longer present at remote, user --delete flag.