Jump to content

RedHat 9.0: alias your rm, cp & mv ASAP!!!


Doryforos

Recommended Posts

Hello,Something I just discovered:RedHat 9.0 installs, by default, different .bashrc files for root, than those of the other users:root's .bashrc contains the following aliases:

    alias rm='rm -i'    alias cp='cp -i'    alias mv='mv -i'

This means that delete, copy and move operations, will NOT by default delete, or overwrite any already existing files, without first asking for your explicit permission ("-i" stands for "interactive").This is not the case, however, for simple users (why, RedHat?). <_<If you want to practise safe hex :D , edit your (and any of your system's already created user's) ~/.bashrc, to include the above lines (read root's for their specific place in the file), AND /etc/skel/.bashrc, so that any newly created user's .bashrc will have those potentially catastrophic commands de-fanged.

Link to comment
Share on other sites

Just had to check. This is clean in Mandrake 9.1Also double checked the cp, rm, and mv commands. They all support the "-f" (--force) switch. This lets you override "-i" when you need to.

Link to comment
Share on other sites

Hi DoryforosI think the -i option is a good thing for "rm", but to have them for "cp" and "mv" too is a bit overdone. I would not want to have to confirm every command I give . . :):thumbsup: Bruno

Link to comment
Share on other sites

Ragnar Paulson

Reminds me of one of my first days in unix... I was in chatting with the sysadmin when a developer rushed in, seems she had accidentally removed a file with a few hours work in it. When informed that it was really and truly gone the developer fumed loudly about the (chose expletitive) unix operating system and how in her old job and the VM system (yeah this was a while ago) histories of all file changes were preserved (file.1, file.2 ... etc) automatically and you could always recover from such errors easily. To which the sysadmin drolly replied, "It should not be astonishing functionality in an operating system that if you ask it to remove a file ... it actually removes the file". :thumbsup: Ragnar

Link to comment
Share on other sites

To which the sysadmin drolly replied, "It should not be astonishing functionality in an operating system that if you ask it to remove a file ... it actually removes the file". :thumbsup:
LOL Rangar !! I like that one !!And as we´re talking CLI: Here is a nice article about "CLI for novices: alias cat and pipe meet grep":) Bruno
Link to comment
Share on other sites

Guest LilBambi

LOL! I love that one too Ragnar! Imagine that an OS that does what you tell it LOL! :w00t:EDIT: Bruno, could you check that link again, I couldn't get there when I clicked on it. It said 404 not found.

Edited by LilBambi
Link to comment
Share on other sites

To which the sysadmin drolly replied, "It should not be astonishing functionality in an operating system that if you ask it to remove a file ... it actually removes the file". :teehee:
That's classic! :P :teehee: Reminds me of the saying "make a foolproof system, and they'll make a better fool".Curiously, there is a program that prevents files from actually being deleted, so you can recover them. It's called safedelete and hasn't been updated in years, but I tried it and it works.
Link to comment
Share on other sites

Here it is:

#!/bin/bashmv $1 /home/bruno/Desktop/Trash#end script

I called it "del" and put it in /usr/bin . . . very simple . . :teehee::teehee: Bruno

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...