Showing posts with label dev-null. Show all posts
Showing posts with label dev-null. Show all posts

Monday, June 13, 2016

Quickly deleting large file

Deleting larger file takes time, but when we dont want the file, why shout be their waiting time to delete it.

These files i am deleting

-rw-r--r--  1 sanjeev.tripurari  1114871328  24931090000 Jun 13 17:28 words3.txt
-rw-r--r--  1 sanjeev.tripurari  1114871328  24931090000 Jun 13 17:28 words2.txt

Normal deletion

$ time rm -fv words2.txt 
words2.txt

real 0m0.672s
user 0m0.001s
sys 0m0.080s


copy /dev/null will make it zerobyte quickly and then delete 

$ time cp -v /dev/null words3.txt 
/dev/null -> words3.txt

real 0m0.321s
user 0m0.001s
sys 0m0.294s


$ time rm -fv words3.txt 
words3.txt

real 0m0.006s
user 0m0.001s
sys 0m0.003s