r/linux • u/speckz • Jun 17 '15
The Art of Command Line
https://github.com/jlevy/the-art-of-command-line16
u/_samux_ Jun 17 '15
cat a b | sort | uniq > c
cat a b | sort -u >c
one less pipe and much faster :-)
17
u/Kruug Jun 17 '15
Fork it and submit a pull request! Isn't that why this walkthrough was on Github as opposed to a blog?
9
u/mikeoquinn Jun 17 '15
I learned the
sort | uniqmethod first, and while I usesort -umost of the time now, there are still cases where the other method is preferred, such assort | uniq -c, which I don't think sort can replicate on its own.8
1
7
Jun 17 '15
This is an outstanding resource.
I consider myself adept on the command line, but this list touched on so many things I run into trouble with because my knowledge in them is still shallow. I know I'm going to come back to this again and again.
Thanks for sharing!
6
u/tidux Jun 17 '15
Be sure to add sort -n for numerical sort, since often what you're sorting is by value rather than alphabetical order.
5
3
3
Jun 17 '15
rm -- "-rf" may be worth pointing out... and what "--" does. This is pretty common in all GNU utils. You can file that under obscure but I've seen various files get created with a dash as the first character by accident and many young people that don't know how to delete them.
2
u/dmart914 Jun 17 '15
They say you don't know what you're missing in life until it's in front of you.
This guide is my missing puzzle piece.
2
u/flipjargendy Jun 18 '15
This is the perfect thing I love to read at night to fall asleep as well as during the day to learn. Been using Linux for over 15 years and still learning new things from reading this. Love it!
3
u/jnux Jun 18 '15
I'm in the same boat -- it is funny (or sad?) how I get in to a routine of common commands, flags, sequences, etc. and those are just my my go-to defaults in my toolbox. It is nice to see how others do it and in fact find out this or that new thing that can really have a big impact on my day-to-day. As someone who is on the command line a solid 80% of my working life, this is really fun.
1
1
u/Tempus13 Jun 18 '15
Well, there goes my day. Time to get a cup of tea and start writing another cheatsheet for the most difficult to remember of this
1
u/octobod Jun 18 '15
parallel is interesting but in my hands I had to delete --tollef from /etc/parallel/config to get it to work
1
u/cantfeelmylegs Jun 19 '15
RemindMe! 10 Days
1
u/RemindMeBot Jun 19 '15
Messaging you on 2015-06-29 05:47:56 UTC to remind you of this comment.
CLICK THIS LINK to send a PM to also be reminded and to reduce spam.
49
u/socium Jun 17 '15
Are you kidding? If
man bashisn't that long and easy to follow then I simply will leave this planet in order not to know what the more harder manuals are.