I want to redirect the tar output when creating .tar file.
CASE 1: when i run command " time tar -c /mnt/my_hierarchy > /dev/null "
time required is very less, and tar even do not go to read the file.
CASE2:
when i run command "time tar -c /mnt/my_hierarchy > /dev/zero"
now time required is large, and i can see the read calls happening.
I
know /dev/zero is not for redirecting output to that device but, when i
googled around i found that, there is no difference in redirecting
output to /dev/null or to /dev/zero , only difference is when you use
/dev/zero as input then you get zeros which is not the case with /dev/null.
If
my information and understanding above is right, then why am i getting
these different time when i perform tar on same hierarchy? Also why tar do not read the file when its output is redirected to /dev/null?
I
want to measure performance in terms of time required to perform tar on
a given hiearchy. so I am not sure which command is correct.
I will be thankful if some one can help me / guide me on this.