ahh

~$ which cat
  • dan@upvote.au
    link
    fedilink
    arrow-up
    85
    ·
    4 days ago

    cat is misunderstood a lot. The purpose of cat is to combine multiple files together (it’s literally short for “concatenate”), like cat *.log to combine all log files together.

    If you’re just using it for a single file, then you should just redirect the file to stdin. These two command lines behave similarly:

    cat foo.txt | some-command
    
    some-command < foo.txt
    

    For head, tail, grep and some other commands, you can just pass in the file name directly as an argument (e.g. grep whatever foo.txt).

  • Dyskolos@lemmy.zip
    link
    fedilink
    arrow-up
    9
    ·
    3 days ago

    I was today’s years old to finally notice the cat-head-tail thing…

    But it also just recently dawned upon me why pacman has those weird “c” as progress indicators…

    I’m not a smart man…

  • HamsterRage@lemmy.ca
    link
    fedilink
    arrow-up
    8
    ·
    3 days ago

    For the past 30 years or so, my brain always tells me to type “last” instead of “tail”. This usually results in some kind of “Permission denied” message that confuses me for a few seconds.

      • HamsterRage@lemmy.ca
        link
        fedilink
        arrow-up
        4
        ·
        3 days ago

        Yes, but it shows information about recent/current logins and requires access a file called wtmp (or something like that, off the top of my head), and that requires privileged access.

        My usual use case where I mix it up is looking at a log file and and I just want to see the last few entries. So my brain 🧠 tells my fingers to type “last logfile”, and when I get the permission message it tells my mouth to go, “Doh!”.

    • Digit@lemmy.today
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 hours ago

      Huh. … I could have swore there was a woman. I even package searched, even in overlays… no woman.

      digit 20260807 tyson gentoo /home/digit % whereis woman
      woman:
      digit 20260807 tyson gentoo /home/digit % which woman
      which: no woman in (/bedrock/cross/pin/bin:/bedrock/bin:/usr/local/bin:/usr/local/sbin:/opt/bin:/opt/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/snap/bin:/home/digit/bin:/usr/games/bin:/usr/games:/bedrock/strata/devuan/usr/libexec/xscreensaver:/home/digit/.cargo/bin:/bedrock/cross/bin)
      digit 20260807 tyson gentoo /home/digit % apropos woman
      woman: nothing appropriate.
      
      digit 20260807 tyson gentoo /home/digit % man cry
      No manual entry for cry
      digit 20260807 tyson gentoo /home/digit % whereis cry
      cry:
      
      

      No woman.

      No cry.

      • rumba@lemmy.zip
        link
        fedilink
        English
        arrow-up
        3
        ·
        4 days ago

        Reverse chronological order, mostly

        tac log.txt |head # would give you newest first

        no good for sort because sort already supports -r

        no need it for tail on large files because tail already skips to the end.

        I do a lot of impromptu bash to sus crap out of logs.

        when you’re balls deep in

        cat log|grep -v foo| rev|cut -f 1-3 -d \ | |rev

        Sometimes tac comes in clutch.

        • Sprocketfree@sh.itjust.works
          link
          fedilink
          English
          arrow-up
          4
          ·
          4 days ago

          That’s fair. I’d usually just use less and drop to the end. My use cases would always need the older log before a newer log though because that’s the start of the problem. At least that’s how I operate.

  • TwilightKiddy@scribe.disroot.org
    link
    fedilink
    English
    arrow-up
    9
    ·
    4 days ago

    I always thought it’s

    head | cat | tail
    

    It, of course, waits for an input, which brings up the one and only question…

    Have you fed your cat?

    • sel@lemmy.world
      link
      fedilink
      English
      arrow-up
      5
      arrow-down
      3
      ·
      4 days ago

      Be careful now, 2000/2010 Linux terminology can be taken as an insult in 2026. /s

      I’m tired of this stupid coddling bullshit with the influx of new Linux users. If you can’t read don’t use Linux. Simple. 😂