Eager Eagle
link
fedilink
8013d

tar --help

cross fingers

tar --hep

Fuck.

Celediel
link
fedilink
712d

Here, this should help.

@perviouslyiner@lemm.ee
link
fedilink
2
edit-2
12d

deleted by creator

It should be a crime to directly link XKCDs images without the corresponding page.

https://xkcd.com/1168/

TheSaneWriter
link
fedilink
712d

I understand and sympathize with Rob on a spiritual level.

Oha
link
fedilink
90
edit-2
13d

I remember it like this:
tar -extract ze file
and
tar -compress ze file

Atemu
link
fedilink
5813d

And also tar -the fuck is in this file

exscape
link
fedilink
2113d

z is for gz files only though, there are plenty of others. xf autodetects and works with all of them (with GNU tar att least).

I hope whoever thought -l should mean “check links” instead of list has a special place in Hell set aside for them.

I have no idea what print a message if not all links are dumped even means.

Was gonna say this. Why TF is list not -l as…everywhere else?

Xtract Ze Vucking File!

I always did Xtract Ze File but I will add Vucking from now on, thanks!

Ah yes, that’s the linux community as I know it. There is one thing someone wants to achieve and dozens of ways to do it. ;)

Nah I just use 7z

No no it’s this:

  1. Decide you’ve gotta use tar.

  2. man tar

  3. Guess-and-check the flags until it seems to work.

  4. Immediately forget the flags.

bahmanm
link
fedilink
1012d

That was my case until I discovered that GNU tar has got a pretty decent online manual - it’s way better written than the manpage. I rarely forget the options nowadays even though I dont’ use tar that frequently.

CarbonScored [any]
link
fedilink
2
edit-2
12d

As much as I also do step 4, to be honest I don’t see people use man anywhere near as much as they should. Whenever faced with the question “what are the arguments for doing xyz”, I immediately man it and just tell them - Practically everywhere you can execute a given command, you can also read full and comprehensive documentation, just look!

Why when explaining, giving examples of shell command are people so often providing shortened arguments. It makes it all seam like some random letters you have to remeber by heart. Instead of -x just write --extract. If in the end they endup using the tool so often they need to write it fast they’ll check the shortcuts.

@catacomb@beehaw.org
link
fedilink
7
edit-2
12d

I don’t even mind the shortened arguments too much, though it doesn’t help. It’s more that every example seems to smush them together into a string of letters.

I would have found

tar -x -f pics.tar ./pics

to be clearer when I was learning. There’s plenty of commands which allow combining flags but every tar tutorial seems to do it from the beginning.

Does every Linux command have options as words instead of single letters?

Tar is as old as IT, that’s why it’s syntax is a bit special.

tar -xf is not really special combining short options isn’t uncommon.

Where tar is nonstandard is that you can leave out the -, tar xf is actually how POSIX specifies it. And we’ve kinda come full circle on that one with many modern utilities using a command syntax, you can read tar xf as “tar extract file” just as you can read git pull as, well, “git pull”.

If you want to see a standard command with truly non-standard syntax have a look at dd.

Nono, dash-parameters are new in fancy GNU tar. And POSIX is not old.

@sonnenzeit@feddit.de
link
fedilink
6
edit-2
12d

Many do as it’s considered good practice, but it’s not guaranteed, it just depends on the individual command (program). Usually you can use the --help option to see all the options, so for instance tar --help.

Most commands will have expanded arguments started with 2 dashes that usually look like ‘–verbose-name-of-option’, they’re usually listed in the man page/documentation along with the abbreviated letter version

They are random letters you have to learn by hard. No one uses the long form. If someone just needs to use it one time they will copy the line from somewhere.

Or just use long-forms like

tar --create --file pics.tar ./pics

instead of

tar -cf pics.tar ./pics

or

tar --extract --file pics.tar```
instead of

tar -xf pics.tar


which is honestly way easier to remember... \^\^
wvstolzing
link
fedilink
2013d

Those are straightforward; it’s the remaining 900 options that are confusing. I always need to look up --excludes and always get --directory wrong, somehow.

aard
link
fedilink
1913d

You also don’t need the dash for the short options.

Also, if you’re compressing with bzip2 and have archives bigger than a few megabytes I’ll like you a lot more if you do it with --use-compress-prog=pbzip2

@sebastiancarlos@lemmy.sdf.org
creator
link
fedilink
30
edit-2
13d

You also don’t need the dash for the short options.

True, but I refuse to entertain such a non-standard option format. It’s already enough to tolerate find’s.

aard
link
fedilink
1713d

Technically the notation with dashes is the non-standard one - the dash form is a GNU addition. A traditional tar on something like Solaris or HP-UX will throw an error if you try the dash notation.

It’s also traditional to eat raw meat, but we discovered fire at some point.

aard
link
fedilink
813d

Don’t try to take my raw ground pork away from me.

Lvxferre
link
fedilink
312d

my raw ground pork away from me.

Who are you, the Mett demon?
Matt Damon made out of mett\

(It works great with beef, too. Bonus points for the raw yolk over it. If not homemade though there’s literally one bar that I trust with this, salmonella is not fun.)

aard
link
fedilink
212d

Not enough onions. Your average mettigel has better mett/onion ratio.

I got toxoplasmosis that way

Leo
link
fedilink
113d

That’s an audible “yuck” from me, man. Well done!

Can’t be well done if it’s raw.

Björn Tantau
link
fedilink
313d

Looks like you Mett your match.

TheSaneWriter
link
fedilink
112d

I like the dashes, they make the options look like options to me.

You also don’t need the dash for the short options.

You know when you meet someone and you’re just like “oh boy, yeah, they’re evil. No humanity at all”

exscape
link
fedilink
713d

ps aux says hi!

I think the -j also compresses with bzip2 but I’m not sure if this is defined behavior or just a shortcut

There’s nothing technically wrong with using xjf rather than xzf, but it’ll bite you if you ever use a non-linux platform as it’s a GNU extension. I’m not even sure busybox tar supports it.

aard
link
fedilink
312d

Yes, but I’m asking you to use pbzip. bzip at best utilizes one core, both for packing and unpacking. pbzip uses as many cores as IO bandwith allows - with standard SATA SSDs that’s typically around 30.

pbzip can only utilize multiple cores if the archive was created with it as well.

Does something similar happen using xz?

I’ve searched for it and xz also doesn’t use multithreading by default, you can change the program tar uses to compress by passing the -I option. For xz using all possible CPU threads:

tar -cv -I 'xz -6 -T0' -f archive.tar.xz [list of directories]

The number indicates the compression ratio, the higher the number, the more compressed the archive will be but it will cost more in terms of memory and processing time

TheSaneWriter
link
fedilink
212d

Thanks for answering your own question, this is useful information.

The “-“ is often not necessary. I use it as a guide to see how long the person running tar has been using it.

Example:

tar -xf file.tar == tar xf file.tar

Fushuan [he/him]
link
fedilink
5
edit-2
12d

They are functionally flags though and uniletter flags should be preceded by a ‘-’, so I would still prefer to have the ‘-’ written, because it conforms with the standard.

But muh POSIX

yeah, you can also ditch that f

tar c /etc/passwd > fu.tar

tar t < fu.tar

tar x < fu.tar

I have to Google for this everytime. What I can never remember is how to check whether I should put my tar.gz into the subfolder first or risk getting a thousand files sprayed into my homedir.

If you have a somewhat decent shell, just smack tab twice after the filename, it’ll list the directories present.

I don’t think tar is actually hard, we are just in the time where we externalize more information into resources such as Google. Its the same reason why younger people don’t remember routes by name or cardinal direction as much anymore.

side note: $ tldr is much better than man for just getting common stuff done.

Aatube
link
fedilink
913d

Yes, but still tar options are kinda janky.

tar, please eXtract the Vucking File!

tar -xvf tarbomb.tar.

Yes, that’s all very well, but you’ll still need to find that image the next time you want to use it.

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

  • Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
  • No misinformation
  • No NSFW content
  • No hate speech, bigotry, etc

Related Communities

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

  • 0 users online
  • 456 users / day
  • 1.38K users / week
  • 3.76K users / month
  • 8.09K users / 6 months
  • 3 subscribers
  • 1.87K Posts
  • 33K Comments
  • Modlog