Some cute hacks in Linux.

Adding aliases permanently:open the .bashrc file in ur favorite editor and add the aliases there have them permanently.

man pages formatted as text :

Take for example : man apropos . It looks great on console but sucks when u list it out to a text file.Try this out:

man apropos | col -bx > myfile.txt

The preceding command writes the man page to myfile.txt, without backspaces (the -b) and with spaces substituted for tabs (-x).

This one is from Mihai Patrascu’s site:

Compressing a file system

Suppose you want to back up a partition of your hard drive, and you want to compress it to save space. So, you take your favorite compression utiliy, and have it compress /dev/hd??. But the compressed file turns out to be much larger than the amount of data on that partition. Why, and how do you fix it?

This is because the compressor doesn’t know that the free blocks on disk are actually free. These blocks typically contain junk left over from deleted files, and the compressor treats them as data. An easy and cute fix is: mount /dev/hd?? /mnt ; cat /dev/zero > /mnt/fill ; rm /mnt/fill ; umount /mnt. This will zero out all free blocks, and the compressor will only work hard to compress the actual data.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s