I noticed whenever I want to delete a folder containing a lot of data using a command line (sudo rm -r folder_name
), the Terminal hangs on for the operation to terminate. But at the same time, when I manually delete a folder of similar size, the deletion is performed instantly without waiting.
Any explanation as to why this difference happens
This updates the pointers to the files
. Yes, or to be more accurate it updates directory's listing of inodes which actually are the pointers to blocks of disk space we call files. +1ed. Also if there's just minimal number of subdirectories and majority of files are there, that's gonna be faster probably, since I think it's only necessary to move subdirectory's inode to another directory's listing. Removing is recursive traversal of whole directory - that's opening syscalls, unlinking syscalls, etc, so of course longer. – Sergiy Kolodyazhnyy Oct 23 '18 at 21:26