SHRINKFILE(1)

πŸ’… SHRINKFILE(1) β€” the InterNetNews era glow-up, bestie

okay so real talk, this is shrinkfile from the InterNetNews docs, and it's literally the friend who helps you clean out your closet but only from the end of the rack πŸ’–


✨ NAME ✨

shrinkfile β€” shrink files on line boundaries, no cap πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

shrinkfile [-nv] [-m maxsize] [-s size] file [file ...]

🌸 DESCRIPTION 🌸

So shrinkfile is that girl who takes your files and shrinks them down to at most a given size β€” but only when their size is bigger than maxsize. And here's the iconic part: it keeps the data at the end of the file. The tail stays, the ancient history goes. πŸ’€

Truncation happens on line boundaries, and a line here is "a series of bytes ending with a newline ("\n")". No line length restriction at all, and files can straight up contain any binary data. It's giving flexible. It's giving unbothered. 🌈

🚨 Important vibe check: if the first line is longer than the absolute value of size, the file gets truncated to zero length. Zero. Gone. Nothing left. That's just how it is, bestie 😭

The maximum file size shrinkfile can handle is 2,147,483,647 bytes. That's the ceiling, periodt.

Temporary files get created in the pathtmp directory as set in inn.conf. And you can use the "TMPDIR" environment variable to point at a different directory if you want to be different about it πŸŽ€

Also cute: a newline will be added to any non-empty file that doesn't end with a newline β€” but only if naturally the resulting file size doesn't exceed size by this addition. It's polite like that. 🫢

Currently this program is used by only nntpsend(8). Main character with a small circle, iykyk.


πŸ’… OPTIONS πŸ’…

  • -m maxsize β€” sets the maximum size allowed before truncation occurs.

By default, maxsize is the same as size (as set with the -s flag). And if maxsize is less than size, then maxsize gets reset to size. The math corrects itself, we love to see it ✨

This parameter may end with a "k", "m" or "g", indicating kilobyte (1,024 bytes), megabyte (1,048,576 bytes) or gigabyte (1,073,741,824 bytes) lengths. Uppercase letters are also allowed, because case didn't do anything wrong πŸ‘‘

  • -n β€” this flag is used to determine if any file is too large. In this mode, no files will be altered. Purely a look, don't touch situation πŸ™ˆ

Exits with status code "0" if any file is larger than maxsize (as set with the -m flag), and exits with status code "1" otherwise.

  • -s size β€” by default, size is assumed to be zero and files are truncated to zero bytes. This flag may be used to change the truncation size. And because the program truncates only on line boundaries, the final size may be smaller than the specified truncation size. It rounds down to the vibe, not the number πŸ’€

This parameter may end with a "k", "m" or "g", indicating kilobyte (1,024 bytes), megabyte (1,048,576 bytes) or gigabyte (1,073,741,824 bytes) lengths. Uppercase letters are also allowed πŸ’œ

  • -v β€” prints to standard output a status line if a file was shrunk. Receipts, bestie πŸ“Έ

πŸ”₯ EXAMPLES πŸ”₯

Example usage, feast your eyes:

shrinkfile -s 4m curds
shrinkfile -s 1g -v whey
shrinkfile -s 500k -m 4m -v curds whey
if shrinkfile -n -s 100m whey; then echo "whey is way too big"; fi

Break it down: πŸ’…

  • The first command shrinks curds to 4 MB if it's bigger than this size.
  • The second command shrinks whey to 1 GB and outputs a log line if the file is bigger than this size.
  • The third command shrinks both curds and whey to 500 kB if bigger than 4 MB, and outputs a log line for the files it has shrunk. Multi-file slay 🫢
  • The fourth command just prints a sentence if "whey" is bigger than 100 MB, without shrinking it. All vibes, no edits. ⭐

🧚 HISTORY 🧚

Written by Landon Curt Noll <chongo@toad.com> and Rich $alz <rsalz@uunet.uu.net> for InterNetNews. Rewritten into POD by Julien Elie. Respect the elders, they built the place πŸ‘‘


πŸ‘‘ SEE ALSO πŸ‘‘

nntpsend(8). That's it. That's the whole circle. πŸŽ€


πŸ’– that's the whole page bestie β€” INN 2.7.4, dated 2022-07-10, straight from the InterNetNews Documentation, and no I did not skip a single flag πŸ’–

πŸ“¦ where this page comes from
  • arch rolling: inn 2.7.4-4 Β· ISC
  • epel 10: inn 2.7.4-5.el10_3 Β· ISC AND BSD-3-Clause AND BSD-4-Clause AND FSFAP AND (GPL-1.0-or-later OR Artistic-1.0-Perl) AND GPL-3.0-or-later WITH Bison-exception-2.2 AND LicenseRef-Fedora-Public-Domain AND MIT AND NTP
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms