common linux commands

1. How to zip a folder having subdirectories?

tar czvf filename.tar.gz foldername

2. Redirecting Root's Mail To Another User Account

Suppose all root's mail on your system is to be redirected to another account say 'sandip@sandip.com' . This is achieved by modifying the /etc/aliases file and appending a line as follows:

#FILE: /etc/aliases

root: ravi@yahoo.com

Now, run the 'newaliases' command to convert the changed /etc/aliases file to the aliases.dbdatabase format

$ newaliases

NOTE: You have to run the command newaliases each and every time you modify the /etc/aliasesfile.

3. How to format pendrive in linux?

Normally pen drive are recognized as sdb or sdc, depending on number of disk. You need to confirm that by fdisk -l or df-h command

Step 1: umount /dev/sdc1 (unmount the pendrive first)

Step 2 : mkfs.ext3 /dev/sdc1 (For ext3 linux partition)

mkfs.vfat /dev/sda1 (For FAT windows parttion)