LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-26-2010, 06:40 AM   #1
siva balan
LQ Newbie
 
Registered: Jul 2010
Posts: 25

Rep: Reputation: 0
rm -rf


I have set,

Code:
alias rm -rf='rm -i'
in my .bashrc file...it is not working.please explain any alternatives...
 
Old 08-26-2010, 06:49 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
I do not think it works that. It will through an error for alias not found. You will need to alias rm to rm -i.
 
Old 08-26-2010, 11:47 AM   #3
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,614

Rep: Reputation: 440Reputation: 440Reputation: 440Reputation: 440Reputation: 440
siva balan

What profit shall it edify a newbie (or anyone) to hide the dangerous effect of 'rm -fr' behind an alias of a friendly interactive 'rm -i' ? In one linux forum I have read that the moderator has warned crooked members who, pretending to help newbies, instead are coaching them to destroy their new system: in that forum article the penalty is deletion, no warning is given.

The fact that a user ambitious enough for that dangerous trick but doesn't know how to write a simple unix/linux alias explains behind that you are not in serious business with linux system nay its young but sprouting community, and for that, I adjure you get back to your dreary world full of Windows and Gates yet imprisoned between the walls of copyrights and patents. Do not come to solicit tricks you can use to fool others to their own frustration. Why don't you go and issue this command in your donkey XP: C:\format C <y> ? For I do not see anything profitable to any linux newbie regarding that trick you are shamelessly asking here.

'rm [options]' command is very dangerous, let me remind everyone here, and may this place not be used to learn foolery to the ruin of others.

I hope this will reach the attention of our forum administrators.
 
Old 08-26-2010, 11:58 AM   #4
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387Reputation: 2387
Hi,

The command you show won't work, it has the wrong syntax.

Assuming that you want to be asked every time you use the rm command: alias rm='rm -i' But......

The -f option overrides the -i option (force and ask don't mix, force "wins").

Only advise I can give you: Set the alias as provided by me and do not use the -f option. This way you are always asked if you want to remove something and have a way out.

And be careful with rm, what you remove can, in general, not be restored.

Hope this helps.
 
1 members found this post helpful.
Old 08-26-2010, 04:08 PM   #5
b0uncer
LQ Guru
 
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Quote:
Originally Posted by malekmustaq View Post
siva balan

What profit shall it edify a newbie (or anyone) to hide the dangerous effect of 'rm -fr' behind an alias of a friendly interactive 'rm -i' ? In one linux forum I have read that the moderator has warned crooked members who, pretending to help newbies, instead are coaching them to destroy their new system: in that forum article the penalty is deletion, no warning is given.

The fact that a user ambitious enough for that dangerous trick but doesn't know how to write a simple unix/linux alias explains behind that you are not in serious business with linux system nay its young but sprouting community, and for that, I adjure you get back to your dreary world full of Windows and Gates yet imprisoned between the walls of copyrights and patents. Do not come to solicit tricks you can use to fool others to their own frustration. Why don't you go and issue this command in your donkey XP: C:\format C <y> ? For I do not see anything profitable to any linux newbie regarding that trick you are shamelessly asking here.

'rm [options]' command is very dangerous, let me remind everyone here, and may this place not be used to learn foolery to the ruin of others.

I hope this will reach the attention of our forum administrators.
I don't get what you're saying. Do you have problems understanding the OP, or what?

The effect of aliasing "rm" to "rm -i" and then using "rm -f" depends on the system. On a SunOS I use I have done just that, and issuing "rm -f" still asks interactively, unless I explicitly run rm with full path ("/bin/rm"). Some other commands seem to be picky about the order of the options as well, so I assume it's because of that. In any case, do not use the force switch unless you really intend to force (in which case make sure you know what you do and have recent backups available).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off




All times are GMT -5. The time now is 08:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration