Re: unbelievably stupid mistake - i broke /usr/lib need help

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jeff Vian wrote:
On Fri, 2006-01-06 at 13:19 -0700, Robin Laing wrote:

Mike McCarty wrote:

Robin Laing wrote:



>More snips.<

The first thing I usually do is make an aliases for rm, cp and mv to ask for confirmation.

alias rm='rm -i'


This is the default setting for root (you can check by running 'alias')
and takes effect when you do an 'su -'.  However, the -f overrides that
(man rm).


I know that -f overides everything. I got into the habit before rm used to do that. I also do it for all accounts as default.

The OP used rm -rf so it would not have mattered at all if the -i option
was set by default.  His typo was a bit destructive.


alias cp='cp -i --backup=t'
alias mv='mv -i --backup=t'

The addition of the --backup option for mv might be nice.  'cp -i' and
'mv -i' are already aliases for root.
Why would I want a backup of a file I am copying?  I am already making a
copy and not changing the original.

Sometimes I have multiple copies of files from different places. If I am copying off of a CD and just by chance the file is different or corrupt I have a backup to compare with. Again it goes with the response to large number of files. It has saved my but more than once when doing a "cp -rf" of a directory tree.

   [root@eagle SL]#  alias
   alias cp='cp -i'
   alias l.='ls -d .* --color=tty'
   alias ll='ls -l --color=tty'
   alias ls='ls --color=tty'
   alias mv='mv -i'
   alias rm='rm -i'
   alias which='alias | /usr/bin/which --tty-only --read-alias
--show-dot --show-tilde'

This is the default list of aliases configured for root on my FC4
system.


I wonder if there is a way to disable the "-f" option in rm as root.


I would not want to!  Using the -f option implies you know what you are
trying to do.
If you did it would take a reply to a prompt for *each* file being
deleted.  Imagine if you were removing a large directory tree!  Even
several hundred files would be extremely irritating (and doing software
development can easily result in a tree of that size quickly).

My rule of thumb is *always check what you type*, then *think* before
hitting the enter key.  This was a hard learned lesson from some time
back with a typo that left my command "rm -rf / ......." using a full
path to a file.  And you *know* what that did ;-(.

How about a second prompt something like "Your are root, are you sure you want to delete using the force option?" as a one time prompt. Of course if the terminal screen was different, it would be a reminder.


I also want to look at the terminal settings and see if I can get the background to change when I su.


That is a very good idea.  An extra reminder that you are in a dangerous
environment.



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux