# How to delete in Terminal?



## Thaiâ¢ZX-6R (Dec 25, 2002)

I'm new to all this and when I try to run MySQL, it says that my one file could not be deleted and that I need to do it manually. It's a pid file. It won't let me just drag it to the trash so I'm wondering how to delete it in terminal...

I know "mkdir" is make directory, "cd" is change directory etc... so the simple question is how do I delete?

Thanks.


----------



## ScottW (Dec 25, 2002)

"rm" is for remove.


----------



## gatorparrots (Dec 25, 2002)

A pid file may require root privileges in order to remove it:
sudo rm /path/to/file

*rm -rf* for directories (recursive force remove).

For directories with root ownership, you will have to do:
sudo rm -rf /path/to/dir


----------



## Jasoco (Jan 1, 2003)

THANK YOU! -rf! -rf!

I am so glad I didn't have to wait for the Trash to delete all the 10GB of files I had in there. I just used rm and it did it in a millisecond.

Why doesn't the Trash Can use the Terminal to delete files? It'd be so much faster.


----------



## wiz (Jan 1, 2003)

not safe though,, cuz what if (sometime_in_the_future) u realise that needed those files or maybe just one of them

ooops no way gettin it back!
actually there is, but NO


----------



## Jasoco (Jan 1, 2003)

Well, I only do it on stuff I KNOW I won't need. They were a duplicate of my entire HD. So.. you know.


----------



## ~~NeYo~~ (Mar 1, 2003)

Wow! Cool, i had a file on my desktop, that WOULD NOT Delete ... it told me it was in use ... but a restart didn't cure it. Using basic structure, i removed the file with Ease! ... that is COOL! ... i might start looking at trying to learn the terminal, and its commands!  

Neyo


----------



## Easter (Mar 1, 2003)

When you delete a file it isn't removed from file system until all application finish tu use it ...
So if you open a file then delete it another application can't open it but the first applicaton can continue to use it.

It's fs feature!

Bye_


----------



## ksv (Mar 2, 2003)

> _Originally posted by Easter _
> *When you delete a file it isn't removed from file system until all application finish tu use it ...
> So if you open a file then delete it another application can't open it but the first applicaton can continue to use it.
> 
> ...



I guess that's because the file would still be in  RAM and therefore not entirely removed from the computer


----------



## Easter (Mar 2, 2003)

Hi ksv,



> _Originally posted by ksv _
> *I guess that's because the file would still be in  RAM and therefore not entirely removed from the computer  *



no ... the effect is the same but the reason isn't that ...
The file remain available to the application using it even if the file is much more greather than the memory available ... try to delete a video while you are watching it. Is the Kernel, FileSystem, etc... that use this non-blocking strategy ... just think that in UNIX everything is a file (even memory, devices, processors, framebuffer).

That's all_


----------

