snarf(1)

πŸ“¦ version 7.0, in debian bookworm, ubuntu jammy

πŸ’– snarf(1) πŸ’–

okay bestie, sit down, hydrate, and let me tell you about snarf β€” the Simple Non-interactive All-purpose Resource Fetcher, aka your new manual-page bestie from the General Commands Manual. no cap, this thing is lowkey iconic. πŸ¦‹


✨ NAME ✨

snarf β€” Simple Non-interactive All-purpose Resource Fetcher


🌸 SYNOPSIS 🌸

snarf [-avqprzm] URL [outfile] ...

like… that's it. that's the whole vibe. URLs go in, data comes out. πŸ’…


πŸŽ€ DESCRIPTION πŸŽ€

snarf goes and gets data for you from a bunch of protocols, namely http, ftp, and gopher. that's the whole job. it fetches. it snarfles. it slays. ✨


🫢 USAGE 🫢

so the way you use it: you hit snarf with any number of URLs and outfiles. yes, plural, go off. πŸŽ‰

if you don't give it an outfile, snarf is a sweetie and preserves the remote file name when saving. so like:

snarf http://foo.bar.com/images/face.gif

will pull down that file ``face.gif'' onto your local system. cute! πŸ’–

but β€” and this is the plot twist β€” if there's no filename at all (the url just ends in a slash), snarf still grabs the data and stashes it in a default file depending on the protocol:

  • index.html for http URLs
  • ftpindex.txt for ftp URLs
  • gopherindex.txt for gopher URLs

now, if you use a dash, "-", as the outfile? snarf sends its output straight to stdout instead of a file. perfect for piping, periodt. 🌈

wanna log in to an ftp server or a website that's gatekeeping with a username and password? use this syntax:

http://username:password@site.com/

and if you omit the password, snarf will prompt you for it. it's polite like that. 🫢

oh and the cutest part: snarf has a built-in option to download the latest version of itself. just run:

snarf LATEST

self-care, honestly. πŸ‘‘

πŸ’… OPTIONS πŸ’…

reminder bestie: each option only affects the URL that immediately follows it. if you want an option to affect all URLs that follow it, use an uppercase letter for the option, e.g. -Q instead of -q. yes, that's real. yes, it's giving main character energy. ⭐

  • -a β€” makes snarf use "active" ftp. by default snarf uses passive ftp, and if the server doesn't support it, it falls back to active ftp. using -a will skip that whole initial passive attempt. no time wasted. πŸ’¨
  • -r β€” resumes an interrupted ftp or http transfer by checking if there's a local file with the same name as the remote file, then starting the transfer at the end of the local file and continuing until it's finished. > ⚠️ heads up: this option only works with HTTP servers that understand HTTP/1.1 and ftp servers that support the REST command. also snarf uses this option automatically if the outfile already exists. she's proactive.
  • -n β€” don't resume. ignore the outfile if it exists and re-transfer it in its entirety. full reset, fresh start, we love a clean slate. 🌸
  • -q β€” don't print progress bars. silence is golden. 🀫
  • -p β€” forces printing of progress bars. here's the tea: snarf has a compile-time option for whether progress bars print by default or not. the -p option overrides -q. also, if progress bars are enabled by default, snarf suppresses them when standard output is not a terminal. using -p will override this behavior too. she does what she wants. πŸ’…
  • -v β€” prints all messages that come from the server to stderr. the full tea, unfiltered. β˜•
  • -z β€” send a user-agent string similar to what Netscape Navigator 4.0 uses. throwback era, we love her. πŸ¦‹
  • -m β€” send a user-agent string similar to what Microsoft Internet Explorer uses. yes, that one. 🫣

🌈 ENVIRONMENT 🌈

snarf checks several environment variables when deciding what to use for a proxy. the order is so important, bestie β€” she checks a service-specific variable first, then SNARF_PROXY, then PROXY. priority queen. πŸ‘‘

the service-specific variables are:

  • HTTP_PROXY
  • FTP_PROXY
  • GOPHER_PROXY

snarf also checks the SNARF_HTTP_USER_AGENT environment variable and will use it when reporting its user-agent string to an HTTP server. and in the same spirit, she also uses the SNARF_HTTP_REFERER environment variable to spoof a Referer to the web server. sneaky. iconic. 😌


πŸ’€ BUGS πŸ’€

Bugs? What bugs? πŸ™ˆ if you find 'em, report 'em. that's the whole policy. fr fr.


πŸ’œ AUTHOR πŸ’œ

Copyright (C) 2000 Zachary Beane (xach@xach.com)


and that's the whole page bestie β€” snarf(1), dated 17 Jun 2000, straight out of the General Commands Manual. go forth, fetch responsibly, and remember: if the transfer gets interrupted, you've always got -r. πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from