
The most useful "Swiss army knife" one-liners on Unix - jonbaer
http://www.quora.com/What-are-the-most-useful-Swiss-army-knife-one-liners-on-Unix
======
keithpeter
"You must be signed in to read this answer"

    
    
        [Sign in with Facebook] [Sign in with Google]
    

No thanks, anyone going to collect and publish the one liners somewhere as a
text file?

~~~
csense
Yeah, screw this. Why does the site want to make me do this? Someone should
repost this question on a popular forum without such annoyances.

~~~
jgeorge
I typically skip quora links for this reason. However, appending "?share=1"
onto the end of the URL makes it readable if it's something you're
particularly interested in.

~~~
csense
That makes this site almost as dumb as a DRM scheme I once read about that can
be disabled by holding a key (Shift I believe) as you put the CD in to prevent
Autorun.

------
miles
I'm always surprised to see "Useless Use of Cat Award"[1] recipients in such
compilations. I know there is some debate[2] around UUOC, but somehow this
sort of thing (from the top-voted answer) seems wasteful:

    
    
      cat access.log | egrep -o 'acct_id=[0-9]+' | cut -d= -f2 | sort | uniq -c | sort -rn
    

Why not just

    
    
      egrep -o 'acct_id=[0-9]+' access.log | cut -d= -f2 | sort | uniq -c | sort -rn ?
    

Perhaps for these sorts of tutorials, the former is clearer on first
inspection. But I can't help agreeing with bahamat[3] that it's about "forming
good habits and discouraging bad ones".

[1] <http://partmaps.org/era/unix/award.html#cat>

[2] [http://superuser.com/questions/323060/what-is-the-general-
co...](http://superuser.com/questions/323060/what-is-the-general-consensus-on-
useless-use-of-cat)

[3] <http://superuser.com/a/323167/38084>

~~~
claudius
At least I tend to build pipes iteratively, that is, I start with ‘cat foo’,
then add grep/cut/sort/uniq as I see fit, checking the output during each
stage.

This, at least, happens if I plan to stay in one line for that particular job
– if I write a proper script, I’ll take care to use grep properly.

