Slashdot Mirror


Interview With the Author of "Mastering Cat"

Shlomi Fish writes "O'Reilly is publishing a new book titled 'Mastering cat,' about the UNIX 'cat' command. Here is an interview O'Reilly-Net conducted with the author about it. Read it to see if this book should be part of your bookshelf of technical books."

55 of 243 comments (clear)

  1. How about the followup? by Fittysix · · Score: 3, Funny

    ?tac gniretsam

    --
    *.sig
    1. Re:How about the followup? by Anonymous Coward · · Score: 5, Funny

      I'd prefer the follow up "Mastering Pussy"

    2. Re:How about the followup? by lord_rob+the+only+on · · Score: 4, Funny

      rob@thinkpad:~$ pussy
      bash: pussy: command not found

      rob@thinkpad:~$ man pussy
      No manual entry for pussy

      Pussy doesn't even exist ...

    3. Re:How about the followup? by h4rm0ny · · Score: 4, Funny

      Pussy doesn't even exist ...

      That's strange. When I try:

      h4rm0ny@mybox~$ grep -r pussy *

      I get lots and lots of results.

      --

      Aide-toi, le Ciel t'aidera - Jeanne D'Arc.
    4. Re:How about the followup? by cayenne8 · · Score: 2, Funny
      Too bad there isn't a Unix command "Bater".....I'm sure that would be his next book.

      :)

      I think it would tend to be more of a self help book than a technical tome though...

      --
      Light travels faster than sound. This is why some people appear bright until you hear them speak.........
    5. Re:How about the followup? by oldspewey · · Score: 4, Funny

      No manual entry for pussy

      I think I see the problem here - try starting her off with 3 or 4 vodka appletinis.

      --
      If libertarians are so opposed to effective government, why don't they all move to Somalia?
    6. Re:How about the followup? by Sir_Lewk · · Score: 3, Informative

      'tac' is an actual *nix program, prints files out in reverse.

      --
      "linux is just DOS with a UNIX like syntax" -- Galactic Dominator (944134)
    7. Re:How about the followup? by palegray.net · · Score: 2, Informative

      for getting [part of] a log file in reverse chronological order

      Funny you should say that, it's exactly how I use the "tac" command.

    8. Re:How about the followup? by palegray.net · · Score: 3, Funny

      pparadis@alpha:~$ vodka
      bash: vodka: command not found
      pparadis@alpha:~$ appletini
      bash: appletini: command not found
      pparadis@alpha:~$ tequila
      bash: tequila: command not found
      pparadis@alpha:~$ liquor
      bash: liquor: command not found
      pparadis@alpha:~$ beer
      The program 'beer' is currently not installed.
      You can install it by typing:
      sudo apt-get install gerstensaft
      bash: beer: command not found

      Wow, I'm off to install beer on my laptop now.

    9. Re:How about the followup? by jonbryce · · Score: 4, Funny

      pussy does exist, however there is no documentation for it, so you have to figure it out for yourself.

      The other thing is, it isn't in $PATH, and slocate doesn't index it, so finding it is an exercise in itself.

  2. I tried mastering cat. by SuperBry · · Score: 5, Funny

    But I kept on getting scratched...

    1. Re:I tried mastering cat. by ControversialMatt · · Score: 5, Insightful

      There's your problem. It's not your cat, you're his person.

  3. Re:Frist Psot? by snowraver1 · · Score: 3, Funny

    There is, but it only works if you are logged in as AC and if you post either a goatse pic, a long post about Obama's shit, or an instruction manual for someone of african decent.

    --
    Copyright 2010. All rights reserved. This comment may not be copied in any way including, but not limited to caching.
  4. Damn. by castorvx · · Score: 5, Informative

    I was hoping for a manual to help me read the icanhascheezburger comments.

    1. Re:Damn. by momerath2003 · · Score: 4, Informative

      That would be "lolcat," not cat. And here is a page to help you.

      --
      I had but a simple dream, to destroy all humans.
  5. Master by Hogwash+McFly · · Score: 3, Insightful

    You can't master any cat, only dogs. As the saying goes - dogs have masters, cats have staff.

    --
    Mother, do you think they'll like this sig?
  6. How hard is it to get CAT to work with HURD? by TinBromide · · Score: 5, Funny

    I've been trying to get my cat to play nice with gnu Hurd for a while. It seems like it starts to work, but then starts to ignore all IO and proceeds to SLEEP(3600). I am eagerly awaiting someone who can get a cat Hurd to work.

    --
    Is it sad that I am more likely to recognize you and your posts by your sig than your name or UID?
    1. Re:How hard is it to get CAT to work with HURD? by mrogers · · Score: 5, Funny

      The trick to controlling a cat Hurd is pipes... lots of pipes.

  7. O HAI by Oxy+the+moron · · Score: 5, Funny

    I CAN HAZ DIS BOOK NOW PLZ??

    --

    Proudly supporting the Libertarian Party.

    1. Re:O HAI by Bob+The+Cowboy · · Score: 5, Funny

      I CAN HAZ DIS BOOK NOW PLZ??
      --

      Proudly supporting the Libertarian Party.

      I knew it... lolcats is a grassroots movement started by the Libertarians to... uhh... get... cheezeburgers?

  8. I just /usr/bin/cat my coffee everywhere. by Mr.+Flibble · · Score: 2, Informative

    I guess I forgot what day it was, but the title article made me spew my coffee in laughter.

    As an aside, remember kids, don't do this:

    cat foo | grep bar

    It is bad Unix! (If you don't know why, read the non-existent book on cat...) ;)

    --
    Try to hack my 31337 firewall!
    1. Re:I just /usr/bin/cat my coffee everywhere. by steveha · · Score: 5, Informative

      As an aside, remember kids, don't do this:

      cat foo | grep bar

      It is bad Unix!

      Eh, it's not that big a deal.

      Yes, you can simply say "grep bar foo" and it will have the same effect with less typing. But it's really not that big a deal, and there are times when I would do this. Usually it is because I'm doing something like this:

      shell_script foo | grep bar

      And I'm not getting the results I expect; then I might swap out the shell script part for cat, to help me debug. It's easier to type

      cat !*

      or even

      ^shell_script^cat

      than to retype the whole command.

      As long as you know what you are doing, build the command line any way you like. The computer exists to serve you, not the other way around...

      Now someone will mod me (-1, No Sense of Humor) or (-1, Beating the Joke Into the Ground). But I regret nothing! Nothing, I tell you.

      steveha

      --
      lf(1): it's like ls(1) but sorts filenames by extension, tersely
    2. Re:I just /usr/bin/cat my coffee everywhere. by TheRaven64 · · Score: 2, Informative
      The correct general way of doing it (which works for all values of grep) is:

      $ grep bar < foo

      You don't need to do this with grep, since it can take a file as input, but in the general case, any time you are using cat with a single file and a pipe you should be using <.

      It doesn't make much difference when you are running a single command, but it makes a huge difference when you are running a loop or something like a find command. The extra cat doubles the number of fork() and read() system calls, adds a load of unnecessary write()s and adds a lot of copying that is otherwise unneeded.

      --
      I am TheRaven on Soylent News
  9. In the news today, a group of IT professionals ... by Phizzle · · Score: 3, Funny

    were found dead. Apparently they were playing a drinking game, and doing a shot for every lolcats reference on Slashdot.

    --
    I will not be pushed, filed, stamped, indexed, briefed, debriefed or numbered. My life is my own.
  10. Neuter to decrease aggression by wonmon · · Score: 5, Funny

    rm -r testes

    1. Re:Neuter to decrease aggression by kg9ov · · Score: 5, Funny

      The cat probably won't be as open to that as you may think... I would suggest using the -f option as well, just to be sure.

    2. Re:Neuter to decrease aggression by upside · · Score: 4, Funny

      How do you remove testes recursively? Are cat testes like Russian dolls? If so, is this somehow related to them having nine lives? Perhaps it makes sense. To kill a cat with any certainty you'd have to do something like

      kill -9 $(ps axe | cut -d" " -f1 | tail -1 | head | cat)

      which - as we know - is an arcane Unixish incantation to kill the cat by putting it in a bag and cutting somewhere between the tail and head with an axe nine times.

      Or maybe you meant rm -f

      P.S. I take no responsibility if you're stupid enough to run that command. Anything or nothing could happen.

      --
      I'm sorry if I haven't offended anyone
    3. Re:Neuter to decrease aggression by Zashi · · Score: 4, Funny

      Parent's command only works after you touch testes

      --
      Skiffy is Spiffy, but Ort is tort.
    4. Re:Neuter to decrease aggression by wonmon · · Score: 3, Funny

      Honestly, I used rm -r because I was thinking that ball1 and ball2 (and sometimes ball3) would be subdirectories, each containing millions of incomplete cat executables.

    5. Re:Neuter to decrease aggression by Anonymous Coward · · Score: 2, Insightful

      -f I can see, but -r?! What kind of cat to you have that you need to recurisvely remove testes? o.0

    6. Re:Neuter to decrease aggression by megaditto · · Score: 3, Funny

      Inside the testes are smaller cats with smaller testes... In fact, it's the ever-shrinking copies of cats with testes all the way down.

      --
      Obama likes poor people so much, he wants to make more of them.
  11. Re:Frist Psot? by Tim+C · · Score: 2, Insightful

    No it isn't, and no, there really shouldn't...

  12. Still Waiting by Kushieda+Minorin · · Score: 4, Funny

    I'm still waiting for "Mastering true" and "Mastering false". The delay is understandable, considering nobody is able to harness the true power of these two commands.

  13. I'm more intersted in tail than cat. by Maxo-Texas · · Score: 4, Funny

    If they released a book on how to master tail (heck, even find tail), it would change slashdot forever.

    --
    She was like chocolate when she drank... semi-sweet at first and then increasingly bitter.
    1. Re:I'm more intersted in tail than cat. by drooling-dog · · Score: 5, Funny

      That would be useful. And if there was one on mastering head, I'd buy it for the GF...

    2. Re:I'm more intersted in tail than cat. by Just+Some+Guy · · Score: 3, Funny

      Alternatively, you could master head. I hear there's demand for it in certain log processing circles.

      --
      Dewey, what part of this looks like authorities should be involved?
    3. Re:I'm more intersted in tail than cat. by fwice · · Score: 5, Funny

      >---joke--->

         O
        \|/    <--- you
        / \

      WHOOSH

  14. Here goes: by IceCreamGuy · · Score: 4, Funny

    ~# date
    Wed Apr 1 13:31:50 EDT 2009
    ~# links2 -dump http://slashdot.org/ >> humortest.txt
    ~# cat humortest.txt | grep $somethingfunny
    ~#

    1. Re:Here goes: by morgan_greywolf · · Score: 2, Interesting

      You should really have RTFA. That's a UUOC. You just completely wasted a process call and unnecessarily wrote to a file:

      links2 -dump http://slashdot.org/ | grep $somethingfunny

      Of course, if we look at your use of an appending redirection (>>) (assuming humortest.txt already exists and has useful data), then you still unnecessarily wrote to a file:

      links2 -dump http://slashdot.org/ | cat humortest.txt - | grep $somethingfunny

    2. Re:Here goes: by IceCreamGuy · · Score: 2, Funny

      I know, I wrote that all out, and then I was like "wait, shit, I can just grep it right from the links2 output." So I wrote it on one line... but then I realized I wasn't using cat anymore and it ruined the joke. Please don't judge me!

      P.S. thanks for introducing me to the phrase "UUOC," now I have something funny to read!

    3. Re:Here goes: by curunir · · Score: 3, Funny

      You must not have gotten to the chapter entitled "Advanced Cat" (page 2). Cat can also be used as a target for piped output.

      Try: ~# wget -o /dev/null -O - http://www.slashdot.org/ | cat | cat | cat | grep $somethingfunny
      ~#

      Voila! No temp file needed. And all due to the power of cat (hint: the third one is the most important.)

      --
      "Don't blame me, I voted for Kodos!"
  15. Talk to the guys at by wiredog · · Score: 2, Funny

    EDS.

  16. Re:I use... by Tetsujin · · Score: 5, Funny

    ...Schroeder's cat. If it works, you don't know it, but if it doesn't you have to try again until you get it to work (if you can tell that it worked anyway). Then the pipe comes out to stop my mind frying.

    That's "Schrodinger's cat". Your license to make quantum mechanics jokes is hereby revoked. To make sure you don't try to take your license back, we're going to keep you updated on its current velocity.

    --
    Bow-ties are cool.
  17. Re:I use... by eXonyte · · Score: 2, Funny

    Funny, I never realized that Schroeder had a cat...

  18. Re:god by bigstrat2003 · · Score: 4, Insightful

    Protip: IGNORE IT.

    Seriously, if you hate all these stories so much, leave /. for the day. It won't kill you. You know they're going to be here all day, so come back tomorrow. You'll be happier because you won't be reading the stories, and we'll be happier because you won't be bitching about our fun.

    --
    "16MB (fuck off, MiB fascists)" - The Mighty Buzzard
  19. Upcoming second edition in 2012 by Tetsujin · · Score: 4, Funny

    The second edition of "Mastering Cat" will include in-depth coverage of the use of "cat" in the new generation of object-oriented Unix shells. Key topics will include:

    • "cat" type safety
    • Using "cat" in traditional mode vs. object-oriented
    • "cat" pitfalls: attempting to run "cat" on non-serializable live objects, "cat" on lists vs. "cat" on text files, using "cat" to capture user input (and dealing with the untyped data stream that results...)

    You think I'm joking? Watch me. Hopefully what I come up with won't be quite the nightmare I'm trying to describe above. :D

    --
    Bow-ties are cool.
  20. But... by cstdenis · · Score: 4, Funny

    it's not even Caturday yet.

    --
    1984 was not supposed to be an instruction manual.
  21. Re:Frist Psot? by cayenne8 · · Score: 5, Funny
    "What is this "African Decent" you speak of? :)"

    Well, it is like regular Descent, except rather than flying through caves, you are flying through a dry, arid desert area. And rather than lasers and smart bombs, you get a spear. If lucky, you get a power up weapon of a coke bottle that comes to you from the gods in the sky.

    --
    Light travels faster than sound. This is why some people appear bright until you hear them speak.........
  22. In case you were wondering what the book's like... by Anonymous Coward · · Score: 2, Funny

    here's a what a simple cat implementation looks like (The book leeaves additional features as an exercise to the reader):

    HAI
    CAN HAS STDIO?
    I HAZ A VAR
    MAEK ARGV[1] A TROOF, O RLY?
      YA RLY, VAR R ARGV[1]
      NO WAI, VAR R "STDIN"
    OIC
    PLZ OPEN FILE VAR?
      AWSUM THX
          IM IN YR FILE EATING UR LINES
        VISIBLE LINES
          IM OUTTA UR FILE
      KTHX
      O NOES
          INVISIBLE "ERROR!"
    KTHXBYE

  23. But seriously by Sloppy · · Score: 2, Informative

    For example, one case where I found that people truly underestimate the power of cat is in the prefixing a line example. You can do that with:
    echo "This would be the first line" | cat - myfile.txt > myfile.txt.new mv -f myfile.txt.new myfile.txt
    But people do not realize that and instead opted to use sed, awk, or even perl (!).

    I've done that.

    --
    As copyright owner of this comment, I authorize everyone to defeat any technological measure which limits access to it.
  24. Wrong cover by dlsmith · · Score: 5, Funny

    O'Reilly would never put a picture of a cat on a book about "cat". It's way too obvious. (Well, nevermind.)

  25. Re:Frist Psot? by Scott+Francis[Mecham · · Score: 2, Funny

    Does the bottle need to be returned at the end of the game, though? Or is that a bonus mission?

    --
    --
  26. Re:Frist Psot? by fprintf · · Score: 2, Interesting

    Been there, done that. A few years ago I got first post and a +5 (w/o karma bonus) interesting. I don't see it listed on my achievements list, but I was pretty proud of it at the time. I think a few of the following comments even said that it was the first time they had seen such a beast, and this of course was when "first post" was an interesting challenge and something noteworthy to attain. Nowadays, meh!

    --
    This post brought to you by your friendly neighborhood MBA.
  27. Re:I use... by Tetsujin · · Score: 3, Funny

    That's "Schrodinger's cat". Your license to make quantum mechanics jokes is hereby revoked.

    That's Schrödinger's cat. Your licence to use Latin characters outside the 7-bit ASCII range is hereby revoked.

    Well, I don't have a license to use Latin characters outside the 7-bit ASCII range - which accounts for why I didn't. :D

    But, still, touche. (D'oh! I did it again!)

    --
    Bow-ties are cool.
  28. obscurix by sbeckstead · · Score: 2, Funny

    I tried
    schroedinger>mkdir /box
    then
    schroedinger>mv cat /box
    Then when I went to look in /box
    schroedinger>ls /box I found two files...
    cat cat.dead
    it's not in the manual...