View Single Post
Posts: 310 | Thanked: 383 times | Joined on Jan 2010
#11
Originally Posted by waleed786 View Post
LOL...would that even work? Even after you did sudo gainroot i dont think it can delete everything because many files would be in use
An unlink() used in rm will never fail because a file is in use; you're updating the parent directory, not the file itself (when you delete something).

An rm -rf / will most certainly delete everything if it has permission, unless the terminal crashes first. The only exception would be pseudo-files (ie. stuff in /proc).

Note that when you delete a file on Linux, all programs that have a reference (open file handle) continue to have access to the file until they close it. Unlinking a file merely removes it from the directory, but it still exists until its reference count becomes 0. At that point the blocks are marked free and can be overwritten.

It's why if you delete a big file that's still in use, you won't see the disk space reclaimed until you kill that process (or the process closes the file).

But um, back on topic.

Neat commands to try:

top - Display running processes interactively
vi - Very old, very powerful text editor (remember: type :q to quit)
du - Display disk usage for a directory
netstat - Display open sockets, routing table, etc

Last edited by nightfire; 2010-02-15 at 03:30.
 

The Following User Says Thank You to nightfire For This Useful Post: