• 2 Posts
  • 3 Comments
Joined 1Y ago
cake
Cake day: Jun 13, 2023

help-circle
rss

Won’t this delete the two newest files, as opposed to everything except the two newest files?


Ah! This is a shell pipe! It’s composing several smaller commands together, cool stuff.

  • ls -1 is the grep-friendly version of ls, it prints one entry per line, like a shopping list.

  • head takes a set number of entries from the head of a list, in this case 2 items. negative two, meaning “all but the last two.”

  • xargs takes the incoming pipe and converts it into extra arguments, in this case applying those arguments to rm.

So, combined, this says “list all the .dump files, pick the first two, all but the last two, and delete them.” Presumably the first are the oldest ones and the last are the newest, if the .dump files are named chronologically.


ah, thank you! it’s actually been long enough that I created a new post here: https://lemmy.world/post/2444639


klay’s simple cookbook for Linux, v0.9.2
Updated my self-hosting tutorial based on suggestions from [last time](https://lemmy.world/post/1740386). The biggest change is the new chapter on network security. If anyone out there is a security nerd I'd love your feedback! I tried to strike a balance between playing it safe and getting something into production.
fedilink

klay’s cookbook for web server admins, v0.5.2
I'm writing my own novice guide to setting up a home server, the stuff I wish I'd been told when I started. Would love feedback from beginners on how useful this is, as well as feedback from veteran self-hosters on how accurate this is, and I welcome suggestions from anyone about what I should add next. update: tweaked the introduction a bit, corrected title to match header, added note about podman-compose v1.0.6 incompatibility. update: major update, v0.9.2 [here](https://lemmy.world/post/2444639)
fedilink