Τρίτη, December 09th, 2008 | Συγγραφέας:

To fail at failing. I recently came across a discussion where a user was advised to run a fail command. The result was, luckily, as follows:

[user@user-desktop ~]$ cd ~/.Trash; sudo rm -rfv *
βίαιο χτύπημα: cd: /home/user/.Trash: No such file or directory
bash: sudo: command not found
[user@user-desktop ~]$

The command cd ~/.Trash γhanges the directorypresent working directory) to the /home/user/.Trash folder. Σε αυτή την περίπτωση, this folder doesn’t exist and so the pwd stays as /home/user/, the folder where όλα the user’s files and settings are saved.

The command rm -rfv * removes all files in the pwd. Ο “vpart indicates that it must show verbose output indicating what is being done during this removal process. The prefixed command sudo (substitute user do) has the command run as ρίζα. Έτσι, had the sudo command been functional, user would have deleted every document he had ever saved in his home folder.

Word of advice from a backup admin: backup often. 😉

Μερίδιο
Κατηγορία: linux
Μπορείτε να ακολουθήσετε οποιεσδήποτε απαντήσεις σε αυτή την καταχώρηση μέσω του RSS 2.0 τροφή. Μπορείτε να αφήσετε μια απάντηση, ή trackback από το δικό σου site.

5 Απαντήσεις

  1. 1
    Tricky 

    The most appropriate command would have been:
    [user@user-desktop ~]$ cd ~/.Trash && sudo rm -rfv *

    The difference is that the “&&” will only run the second command *if* the first command is successful

  2. 2
    Tricky 

    ^^ or even just:
    [user@user-desktop ~]$ sudo rm -rfv ~/.Trash/*

  3. 3
    moo 

    You knowOSS geekery is so depressingif you were an MS nerd as nature intended there wld just be a group policy to stop this from happening. You may now commence to rebutt.

  4. 4
    moo 

    That being said, the occasional visit from the rm -rf fairy never did anyone any harmalong the same lines as the principles of following a high-fibre diet, and probably for the same reason

  5. 5
    Tricky 

    I love fairies. 🙂

    Only rebutt is that it isn’t specifically an OSS problem. Διαφορετικά, I’m happy having your honest comments here. 😉

    U just got me reading up on RBACprobably the future of *nix security. Time will tell. 😉

Αφήστε μια απάντηση » Σύνδεση