this post was submitted on 14 Nov 2026
42 points (87.5% liked)

Linux

68768 readers
796 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 7 years ago
MODERATORS
42
A joke... (lemmy.ca)
submitted 1 day ago* (last edited 1 day ago) by chenwu@lemmy.ca to c/linux@lemmy.ml
 

When I feel like scrapping the whole project and starting over:

Me: (in the project dir) sudo rm -rf /*
Me: (after waiting a while) Something feels off… Why is it taking so long to delete everything?
Me: (suddenly realizing) ^C ^C ^C
System: Press any key to continue...

当我想把整个项目推倒重做时:
我:(在项目目录)sudo rm -rf /*
我:(等了一会儿)有点不对劲。。。怎么删了这么长时间还没删完
我:(恍然大悟)^C ^C ^C
系统: Press any key to continue...

top 23 comments
sorted by: hot top controversial new old
[–] intrepid@lemmy.ca 1 points 4 minutes ago

This is apparently a joke! But I have done this in real life. It's an honest mistake you can make if you're experienced, fast, complacent and careless. Always be prepared for it. Here are some tips:

  1. Don't use sudo for anything other than system operations. Not even for editing configuration files.

  2. Never put any development/sysadmin projects under ownership of root. Always develop the project under your personal unprivileged user account. Use sudo only for the final deployment of project to system directories.

  3. Use sudoedit to edit any system configuration files.

  4. Avoid ./* at all times in favor of just *. While this is counterintuitive, this is actually safer. You will have less habitual urge to type the / alone by accident.

  5. Avoid the -f flag in all instances for any command until some operation fails. That will leave you with enough time to reflect on your mistakes when you make one.

  6. Always keep a data recovery plan. Backups are highly recommended. If you use Btrfs partitions, you can make periodic read-only snapshots of your critical data. You can automate this process with a tool like Snapper.
    Btrfs snapshots store de-duplicated data. So each snapshot stores only the changes from the previous one. It doesn't use a lot of space, even when backing up large media files. You'll still get the chance to recover your data at the time of the last snapshot.

  7. Most operating system files aren't critical data and don't need to be backed up. Backup the system configuration files in /etc and the package installation list if your package manager facilitates it.

  8. This is optional, but useful in case your Linux installation gets nuked somehow, including this nonsense.
    You can always reinstall the distro and start over again. But often times, you can trivially recover the installation by booting from a live USB/CD and doing some manual repair. Learn to chroot into your nuked root partition and operate from inside it.
    Most live disks give you an option to repair an installation, in case you deleted the root partition by accident. You can also repopulate the deleted files using commands like debootstrap and pacstrap.

[–] sudoer777@lemmy.ml 2 points 6 hours ago* (last edited 6 hours ago)

One time I ran rm on a directory and it started deleting files on the NAS mount I had in that directory and forgot about. So note to self: do not mount things inside project directories

[–] schuelermine@leminal.space 1 points 7 hours ago (1 children)
[–] tyranover@lemmy.blahaj.zone 5 points 3 hours ago (1 children)
rm -rf /*

This deletes everything in root; a great way to break your OS and lose all data too.

OP meant to run

rm -rf ./*

Note the period, which represents the current directory. So this deletes everything in the current directory instead of the entire filesystem

[–] chenwu@lemmy.ca 1 points 1 hour ago (1 children)
[–] intrepid@lemmy.ca 1 points 54 minutes ago* (last edited 50 minutes ago)

Why not just:

rm -r *

What is the necessity of that sudo, -f and /?

Disclaimer: I have carelessly committed this nonsense too. Thankfully, the important data was backed up. I used a live USB to access the nuked OS partition and used chroot to repopulate the deleted system files. Didn't even have to reinstall the OS.

Always have a disaster plan. If you have a btrfs partition, even periodic btrfs snapshots are a cheap lifesaver. Everything else can be saved like a breeze with some terminal magic.

[–] Guiorgy@lemmy.ml 7 points 14 hours ago (2 children)

Me who wants to remove a system-wide script:

rm -rf /usr/bin /local/script.sh

Yes, the space was an accident, and yes, this did happen 😋

[–] raspberriesareyummy@lemmy.world 18 points 1 day ago* (last edited 1 day ago)
mv folder delete-this
rm -rf delete-this

gives you one chance to reconsider what you just did before it is too late. And you never have a risk of a dangerous delete-all lurking in your command history.

[–] pelya@lemmy.world 20 points 1 day ago (2 children)

Why do you need sudo to run your project? Are you developing kernel drivers?

[–] chenwu@lemmy.ca 1 points 10 hours ago (1 children)

Looking at your avatar, do you play Freedoom? Deadflare from version 0.12. This post is just a joke, don't take it too seriously.

[–] pelya@lemmy.world 1 points 4 hours ago (1 children)

I don't play Freedoom regularly, I just like the sprite. I ported it to KaiOS though.

[–] chenwu@lemmy.ca 1 points 1 hour ago
[–] addie@feddit.uk 6 points 1 day ago (1 children)

Even then, nothing in the build directory should have unusual permissions. make && sudo make install or whatever.

[–] Ooops@feddit.org 8 points 22 hours ago* (last edited 18 hours ago) (1 children)

It's laziness. A lot of the build stuff is read-only. And as the simple art of yes | rm -r <folder> is dying, sudo is an "easy" way to avoid having to type Y dozens of times.

[–] megaman@discuss.tchncs.de 4 points 22 hours ago

Ope, didn't know i could do that that safe way.

[–] ColdWater@lemmy.ca 10 points 1 day ago* (last edited 1 day ago) (1 children)

That's why I always delete in file manager, if I made a mistake I can retrieve it from "waste bin", can you make some kind of recycle bin for rm command? Nvm I found this after 5 second of online searching https://github.com/babarot/gomi

[–] TheCornCollector@piefed.zip 10 points 1 day ago

Idk about gomi, but trash-cli is a standard package I install on all of my computers

[–] akunohana@piefed.blahaj.zone 11 points 1 day ago* (last edited 1 day ago) (1 children)

No biggie. At least you preserved /. :)

[–] liinux@pawb.social 3 points 15 hours ago

Good point, if I do this I can distrohop without worrying of installing anything!

[–] rbn@sopuli.xyz 4 points 1 day ago
[–] Admetus@sopuli.xyz 1 points 1 day ago

I feel like I should try this one day if I reset my distro.