Friday, March 24, 2017

Re: [LINUX_Newbies] rm -f

 

On 24Mar2017 19:11, highskywhy@yahoo.de <highskywhy@yahoo.de> wrote:
>the problem is NOT
>system files
>
>we wanna delete in win and libnux HTM files.
>RM brings the message: file is in use

As others are pointing out, something is preventing removal and lsof etc may
help you there, eg:

lsof /path/to/the/file

You will probably need to be root when you run lsof, because otherwise lsof
will only report on your own processes. But try it as you first, it may be your
own processes holding the file.

However, on UNIX systems (includes Linux) a file being in use does not prevent
you removing it. That is Windows behaviour. Are you asking about Windows or
UNIX?

Regarding the -f option to rm:

On UNIX, -f does not add any more "power" to rm; it does allow you to remove
something that cannot ordinarily be removed.

What -f does is (a) stop rm complaining if it fails to remove something and (b)
stops "rm -i" from _asking_ before trying to remove some things such as file
you don't own.

Never use -f unless you are very sure that it is what you want; usually it
brings little value and only risk.

The reason so many people routinely use -f is that these days, many Linux
systems ship with a shell alias "rm=rm -i". That causes all interactive "rm"
commands to turn into "rm -i", which asks about removing files you don't have
write permission to, on the basis that maybe you didn't mean to remove the
file.

It prevents a lot of accidents (which, I suppose, is good when so many Linux
systems are in the hands of nonexperts), but the flip side is that humans,
being what they are, take to routinely adding "-f" to their "rm" commands just
to make them shut up.

The better fix is to disable the alias, so that "rm" just means "rm".

The big trouble with "rm -f" is that it doesn't report failure, so you might go
"rm something" and think it is removed when it is not. Not good.

Cheers,
Cameron Simpson <cs@zip.com.au>

__._,_.___

Posted by: Cameron Simpson <cs@zip.com.au>
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (26)

Have you tried the highest rated email app?
With 4.5 stars in iTunes, the Yahoo Mail app is the highest rated email app on the market. What are you waiting for? Now you can access all your inboxes (Gmail, Outlook, AOL and more) in one place. Never delete an email again with 1000GB of free cloud storage.

To unsubscribe from this list, please email LINUX_Newbies-unsubscribe@yahoogroups.com & you will be removed.

.

__,_._,___

No comments:

Post a Comment