LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training 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 05-03-2006, 06:07 PM   #1
Dragons Master
LQ Newbie
 
Registered: May 2006
Posts: 7

Rep: Reputation: 0
rm doesn't prompt for whether to remove the file :(


Hey Folks,

I'm having a slight annoying problem with a new linux box I got - the "rm" command doesn't prompt me whether I wanna remove the file or not - it works as if "--force" is turned on by default..

The man pages say
Quote:
If a file is unwritable, the standard input is a tty, and the -f or --force option is not given, rm prompts the user for whether to remove the file. If the response does not begin with `y' or `Y', the file is skipped.
I've got the same config on 2 boxes I've got but one prompts me when I wanna delete something without --force and one doesn't (unless it isn't writable mode) - anyone has any idea how to change it so that unless I put -f or --force it will ask me? even if the mode is 777
 
Old 05-03-2006, 06:26 PM   #2
Freestone
Member
 
Registered: Jan 2003
Location: Brighton, Michigan
Distribution: FC5
Posts: 114

Rep: Reputation: 15
Dragons Master,

Check your .bashrc file and make sure you have your aliases set.

Here's a copy of my .bashrc file. (Your .bashrc file is your home directory)

--------------------------------------------------
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias lm='ls -m'

# Option shortcut for clearing the screen and changing the command prompt

function c {
clear
}

PS1="\@ \w : "

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
-------------------------------------------------

If your rm alias isn't set to '-i', it won't be interactive and just do the command without you having the chance to say yes or no.

Add alias rm='rm -i' and let us know how it goes.

Good luck!
 
Old 05-03-2006, 06:26 PM   #3
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
I would suggest checking aliases first. Sometimes the -f flag is added by default to a user's shell profile or RC file.

Run alias from the command line and see if you have an alias for rm. If you do, check your ~/.bash_profile or ~/.bashrc (assuming you use the bash shell) to see if the alias is automatically created in them.
 
Old 05-03-2006, 07:15 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670Reputation: 670
On some distro's, such as Mandrake, there is an aliases script that sets the aliases for all of the users. It is sourced by the /etc/profile script when a user logs in. You can either add an entry to that file, or alter your ~/.bash_login ~/.profile or ~/.bashrc file.

This assumes that you use bash as your default shell. Another shell may have it's own startup script.

Last edited by jschiwal; 05-03-2006 at 07:17 PM.
 
Old 05-04-2006, 08:02 AM   #5
Dragons Master
LQ Newbie
 
Registered: May 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Awesome people - that works brilliantly..
I am actually using tsch so it was .cshrc, I added
alias rm 'rm -i'
and it worked perfectly after I logged out and in again..
by the way is there a command to reload .cshrc? or just the aliases? I tried newaliases but that's a postfix command, there's no man page for alias so, is there a way? just out of curiousity really 'cuz logging out and in really seems like not the optimal way of doing it

Thanks a tons folks
 
Old 05-04-2006, 08:07 AM   #6
ethics
Senior Member
 
Registered: Apr 2005
Location: London
Distribution: Arch - Latest
Posts: 1,522

Rep: Reputation: 45
you can source files, which as i understand just executes them.

I use it when making changes to my .bash_profile

so
Code:
 source .cshrc
you'll need the path i imagine unless running the command from the same directory
 
Old 05-05-2006, 07:05 AM   #7
Dragons Master
LQ Newbie
 
Registered: May 2006
Posts: 7

Original Poster
Rep: Reputation: 0
Awesome! that does the job thank you!
 
  


Reply

Tags
force, rm


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
to remove a directory without the need of repeatedly answering prompt Niceman2005 Linux - General 7 08-08-2016 12:29 PM
Remove "are you sure you want to quit" prompt in MythTV cdhgee Linux - Software 0 07-24-2005 05:56 PM
c++ file processing -- how to remove a record from a file sharonyiisl Programming 4 09-26-2004 04:54 AM
How do you copy and paste a file from a command prompt? thenewguy05 Linux - Newbie 6 07-13-2004 04:41 PM
How to play a wav file from the Command Prompt arraman Linux - General 1 08-02-2001 08:13 AM


All times are GMT -5. The time now is 04:35 AM.

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