My PC is Mac pro.

I removed x for rm in case of delete files by accident:
sudo chmod o-x /bin/rm

However, when I reboot my PC, I got one message on the terminal:

-bash: /bin/rm: Permission denied

If I do o+x for bin/rm, the message will disappear.

So I just want to know that which files are automatically removed when the system starts up.

  • 2
    chmod o-x /bin/rm? That's insane. Who knows how many processes may need to delete files for whatever reason? Better create an alias or something instead of this. – muru Feb 3 '17 at 1:30
  • or write a wrapper around /bin/rm that displays the parent process and/or parameters, then calls the real rm – Jeff Schaller Feb 3 '17 at 2:55

There is a lot of cleanup at startup, for example removing files in /tmp. So you shouldn't change /bin/rm permissions.

If you fear to delete files by accident you can alias rm to rm -i so that you will be always prompted for confirmation. alias rm='rm -i' in /etc/profile or /etc/bash.bashrc or equivalent.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.