Removing multiple files? What a pain!

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Removing multiple files? What a pain!

Post by Ree »

I, the windows guy, stepped into the Linux world. :lol: My hands are tired from typing all those tiny commands in my SSH client. I wonder how come I cannot tell the damn machine 'delete the whole stuff inside [dir] and don't ask me anything'. rm description says:

-r — recursive. Will delete a directory and all files and subdirectories it contains.

I run 'rm -r mydir' and it should just delete the whole dir. But it doesn't, it keeps asking me for confirmation of deleting subdirectories and files.

rm: descend into directory `php-5.1.4'? y
rm: descend into directory `php-5.1.4/ext'? y
rm: descend into directory `php-5.1.4/ext/standard'? y
rm: descend into directory `php-5.1.4/ext/standard/tests'? y
rm: descend into directory `php-5.1.4/ext/standard/tests/file'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug32160.phpt'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug32160.txt'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug35740.phpt'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug35781.phpt'? y
rm: remove regular file `php-5.1.4/ext/standard/tests/file/bug37158.phpt'? y

I don't want to believe you can't delete multiple files/dirs quickly. Please tell me I am wrong and let me know the correct way to do that.
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

OK, -rf. But why nobody bothers to mention this in the manuals?
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

Ree wrote:OK, -rf. But why nobody bothers to mention this in the manuals?
It does: http://unixhelp.ed.ac.uk/CGI/man-cgi?rm (See -r , -f, and so forth).

The less humorous reply is that those are mentioned later to avoid a new user performing rm -rf from / , as root, destroying the OS.
Ree
Forum Regular
Posts: 592
Joined: Fri Jun 10, 2005 1:43 am
Location: LT

Post by Ree »

Oh yeah, they do mention all those letters:

rm -r
rm -f
...

But they didn't mention they can be used together.
User avatar
sweatje
Forum Contributor
Posts: 277
Joined: Wed Jun 29, 2005 10:04 pm
Location: Iowa, USA

Post by sweatje »

Was right at the top of the man file for me...
man rm wrote:
NAME
rm - remove files or directories

SYNOPSIS
rm [options] file...

POSIX options: [-fiRr] [--]

GNU options (shortest form): [-dfirvR] [--help] [--version] [--]
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

Are people suggesting:

man -RTF ;)
(#10850)
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Post by Chris Corbyn »

It actually sounds like you may have rm set to alias as `rm -i'. SuSE linux used to do this by default.

Check your .profile and .bashrc scripts for:

"Alias rm=rm -i"
Post Reply