News for hackers. Stuff that matters.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by megaman22 on Wednesday May 23, 2018 @04:47PM (#17138113)
If I do one thing this year, I need to learn more about these tried and tested command-line unix shell utilities. It's becoming increasingly obvious that so many complicated and overwrought things are being unleashed on the world because (statistically) nobody knows this stuff anymore.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by deckard1 on Wednesday May 23, 2018 @05:58PM (#17138743)
This applies to much of the software world. Many of the places I've worked have a bad habit of ditching perfectly fine tech in order to chase the latest thing. Part of it is driven by RDD (resume driven development) and positioning the company so they can hire the latest crop of fad chasers. You end up with a bunch of specialists that are siloed into their particular tech. You got the Docker guy. You got the Redis guy. You may even have one of those gray-haired DBAs that still talk about this "Oracle" thing all day long, and no one knows what the hell he's going on about. You got the Ruby guys, but now you guy a bunch of React or Angular guys. What to do with the Ruby guys? Can't just fire them yet. You have a dozen of 'em, and it took you years to hire them. Fine, just banish them to the backend somewhere. Give them some fidget spinners and a few pointless projects to keep them busy.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by monksy on Wednesday May 23, 2018 @09:00PM (#17140018)
Let's not forget when you're interviewing: The new places expect the latest technologies. Don't have time to learn spark, flink, kafka streams, and repeat scala spec whilst having intimate knowledge of all of the REST libraries? BAD DEVELOPER.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by tomc1985 on Wednesday May 23, 2018 @08:05PM (#17139672)
Hey now, Ruby ain't dead. I am one of these "Ruby" guys and, in the 48-or-so hours since my profile was activated at a new recruiting shop this week, I've gotten several potential candidate employers (some in seed stage) who want to get in touch.

The real issue is why do we silo ourselves so? It's fucking stupid. I do so much more than Ruby but conveying that to the new breed of tech people is just impossible. All they see is your biggest resume badge, and all they care about is how wide you will spread your legs for them.

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by sixdimensional on Wednesday May 23, 2018 @07:13PM (#17139333)
This is exactly right. This is real life!! And it hurts.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by asicsp on Thursday May 24, 2018 @03:20AM (#17141763)
I have a repo dedicated to cli text-processing..

short-descriptions and tons of examples.. I had fun and learned a lot doing this

link: https://github.com/learnbyexample/Command-line-text-processi...

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by svde on Thursday May 24, 2018 @03:35AM (#17141848)
This looks exactly like what I was looking for. Thank you.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by asicsp on Thursday May 24, 2018 @07:43AM (#17143025)
you're welcome, happy learning :)
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by eb0la on Wednesday May 23, 2018 @06:45PM (#17139147)
You just need to master a few commands:

Find (take a look at -exec option)

Cut (or awk)

Sed (for simple text/string substitutions)

Xargs

Dd (that beast can do charset transtation from ASCII to EBCDIC to use in mainframes and can also wipe disks)

And bash of course :)

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by jake_morrison on Wednesday May 23, 2018 @10:57PM (#17140706)
One fun thing is that xargs supports parallelization.

    -P max-procs
    Run up to max-procs processes at a time; the default is 1.
    If max-procs is 0, xargs will run as many processes as
    possible at a time.  Use the -n option with -P; otherwise
    chances are that only one exec will be done.

    -n max-args
    Use at most max-args arguments per command line.
    Fewer than max-args arguments will be used if the size
    (see the -s option) is exceeded, unless the -x option is
    given, in which case xargs will exit.
So here is a "map/reduce" job which takes the log files in a directory and processes them in parallel on eight CPUs, then combines the results.

    find . -name "*.log" | sort | xargs -n 1 -P 8 agg_stats.py | sort | merge_periods.py
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by Groxx on Thursday May 24, 2018 @03:29AM (#17141817)
xargs is one of my favorites, it's so easy to split something apart to speed it up by a few multiples.

gotta SSH into 100 machines and ask them all a simple question? xargs will trivially speed that up by at least 10x, if not better, just by parallelizing the SSH handshakes.

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by adrianN on Thursday May 24, 2018 @12:37AM (#17141135)
And for cases where xargs parallelism isn't flexible enough, there is GNU parallel.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by IndustrialJane on Monday May 28, 2018 @11:53PM (#17176355)
But that approach is potentially dangerous. See:

https://mywiki.wooledge.org/BashPitfalls#Non-atomic_writes_w...

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by eanzenberg on Wednesday May 23, 2018 @07:50PM (#17139575)
"master a few commands"

"awk"

brb 15 years

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by buserror on Thursday May 24, 2018 @07:21AM (#17142921)
Not really. awk is pretty simple, basically I just assume it's plain C with a huge regexp pattern 'switch' case at the top level, then I google again for the arguments to substr() :-)
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by heyoni on Thursday May 24, 2018 @09:06AM (#17143553)
Brb in 20 years then.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by ccozan on Thursday May 24, 2018 @05:32AM (#17142423)
Might be true. The sed&awk from O'Reilly still lingers on my desk from time to time. And I bought it 20 years ago.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by tjr225 on Wednesday May 23, 2018 @10:56PM (#17140698)
Some of these have come up for me recently, particular sed, awk, and xargs. Xargs in particular is really gnarly and opens up a lot of possibilities from the command line when used in conjunction with other tools. Love it!

Not a program, but another fun bash thing I've learned about recently is brace expansion: https://www.linuxjournal.com/content/bash-brace-expansion

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by throwaway5752 on Thursday May 24, 2018 @02:16AM (#17141500)
'man' is probably the most indispensable.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by jonhendry18 on Sunday May 27, 2018 @02:47AM (#17165810)
I find 'apropos' pretty indispensable, because it lets you find the thing that does the thing you need, so you can read its man page.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by commandlinefan on Thursday May 24, 2018 @10:41AM (#17144404)
That sounds interesting. Is it documented anywhere?
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by throwaway5752 on Thursday May 24, 2018 @11:01AM (#17144645)
No, it's something neckbeards pass along to junior sysadmins, and it's hidden very deep in /dev/null.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by sidlls on Wednesday May 23, 2018 @07:26PM (#17139414)
awk is so beautiful. A good awk one-liner can beat fancy pandas all day long in some cases.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by flukus on Wednesday May 23, 2018 @08:23PM (#17139782)
I hate how awk gets so much praise for one liners when it's so good at building things like state machines too: https://two-wrongs.com/awk-state-machine-parser-pattern.html

I've got some similar ones for work that take data csv like data and output sql. A little bit of vim-foo on the csv (yy10000p) and I've got all the test data I need.

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by cosmie on Wednesday May 23, 2018 @08:33PM (#17139852)
If anything, awk should get some praise for it's flexibility to go from one liners to Doom-style 3d games[1]!

[1] https://github.com/TheMozg/awk-raycaster

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by cwilkes on Thursday May 24, 2018 @07:39AM (#17143005)
An example here would be nice.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by hoffbrau99 on Wednesday May 23, 2018 @07:47PM (#17139549)
Don't forget grep!
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by pisky on Wednesday May 23, 2018 @08:29PM (#17139829)
Also, 'parallel' if you've got any idle cores on your infrastructure.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by foobarian on Wednesday May 23, 2018 @08:52PM (#17139964)
And perl -pe or -ne ! :)
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by Groxx on Thursday May 24, 2018 @03:31AM (#17141833)
^ the moment you do anything even slightly non-trivial with sed, abandon it and use perl instead. for even simple regexes with a couple non-"match this char" segments I regularly see almost 100x speedup, it's rather crazy. it's also a LOT more portable in my experience because the regex engine is so much more capable and consistent, even across fairly major perl versions.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by crehn on Thursday May 24, 2018 @09:34AM (#17143789)
Honorable mention to jq. Also get comfy with Unix pipes and streams.

e.g. testing in CI a JSON file is properly formatted:

  jq . < $f | diff -u $f -
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by frou_dh on Friday May 25, 2018 @01:58AM (#17150978)
Personally, I'm not too interested in any commands that take string arguments in their own homegrown programming language[0]. I'd rather use something like this[1] than jq, to get some extra ROI out of one of the languages I already know.

[0]: https://stedolan.github.io/jq/manual/

[1]: https://github.com/antonmedv/fx

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by rickycook on Thursday May 24, 2018 @03:18AM (#17141749)
adding socat into the mix if you do network related things! it’s amazing what you can do when you replace bits and pieces of a pipe chain with network endpoints
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by nemild on Wednesday May 23, 2018 @09:11PM (#17140093)
I made a list of a good set of commands for a full stack engineer:

https://github.com/nemild/cli_for_full_stack

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by sh87 on Thursday May 24, 2018 @03:20AM (#17141762)
This is awesome! thanks.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by cosmie on Wednesday May 23, 2018 @09:55PM (#17140376)
Companies aren't making these complicated and overwrought things because nobody knows this stuff anymore. The ones actually doing the making generally know all the tried and tested ways to do what they want, because they used them to scale. Then they eventually outgrow the existing solutions and created these complicated systems to account for whatever specific technical or business issues that necessitated hopping from existing solutions to creating a solution.

The problem tends to come along with the visibility that comes when one of these get released publicly. People use these things without doing the same level of due diligence to see if something less complicated fits their needs. Either deliberately (resume driven development) or simply because it doesn't occur to them to do so and "if it's good enough for this unicorn it's good enough for me". Or in some cases they do due diligence, but incorrectly evaluate their needs and rule out simpler solutions.

But the most common reason I've ran into is simply that it's more fun to play with these projects than it is to use crufty old stuff, no matter how tried and tested and potentially appropriate it is.

At a previous company, I had a python script running on a cron job every 5 minutes to do some data processing needs. Once or twice a month, the batch would be so large that it took 6-7 minutes to complete and the cron job would trigger the script again before it finished, causing the second instance of the script to see the lock file, log an error, and exit. It didn't cause any problem for these periodically skipped runs, because the business need only required data to be processed within 24 hours of coming in. The 5 minute cron job was just to even out resource usage throughout the day instead of doing a larger nightly batch job. A piece of data not getting processed for 8 minutes instead of 5 did not make any material impact.

Another team had noticed the errors popping up in the log and were in the process of testing out a whole bunch of real time data pipelines like Kafka, leveraging my error messages to justify the need for a "real time" system without ever even asking me about the errors. After I found out other people were noticing those superfluous errors, I moved the cron job to a 30 minute window to stop them from happening anymore. Turns out they didn't have any other justification for their data pipeline greenfield project and weren't happy to go back to their normal day to day work. I offered to let them maintain and expand my python scripts if they were interested in data processing work, but for some reason they never took me up on that offer. :(

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by commandlinefan on Thursday May 24, 2018 @02:06PM (#17146657)
> more fun to play with

I think this is a dangerous, irritating mythology that programmers permit to their detriment. Skipping work entirely to go play pool or watch a movie is "fun". Evaluating a new technology stack to see if it fits business needs (present or future) might be _intellectually stimulating_, but deriding it as "fun" - and allowing management to write it off as time-wasting - hurts everybody. This isn't "fun", it's research, just the same as particle physics experiments are, and it's a big part of what we went to college to learn to do effectively.

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by gaius on Thursday May 24, 2018 @02:01PM (#17146584)
Companies aren't making these complicated and overwrought things because nobody knows this stuff anymore. The ones actually doing the making generally know all the tried and tested ways to do what they want, because they used them to scale

Right, Yahoo made Hadoop because (probably) they needed it. 99% of companies... just don’t.

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by shawndumas on Wednesday May 23, 2018 @11:40PM (#17140910)
Read The AWK Programming Language by Alfred Aho, Peter Weinberger, and Brian Kernighan

"This is an absolute classic which although ancient in Computing years is an absolute gem full of relevance yet."

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by sitkack on Wednesday May 23, 2018 @09:25PM (#17140184)
You can write many of these yourself. Just reading records, and sending them across pipes in ways you can compose is a good start. I find PyPy is excellent for this kind of work, fast to write, if the pipeline runs for more than 10 seconds, it has plenty of time for the JIT to warm up and amortize the cost. If you don't need fancy libs, LuaJIT is amazing and great to doing transforms in a pipeline.

I rewrote a Hadoop job to use Streaming (pipes, basic unix model) from a Java job to native. Just that switch was 10x faster. Mostly because of Hadoop overheads.

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by trumped on Wednesday May 23, 2018 @04:56PM (#17138189)
They try to make the cloud relevant for a lot of things that could easily be accomplished locally... Most of the time, they do that just to get your data.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by SteveNuts on Wednesday May 23, 2018 @05:18PM (#17138404)
Vendor lock-in is what they're after in the cloud case. Every time we talk to our cloud provider reps they ask us which of their SaaS offerings we're using. Their heads spin when we tell them we're just using VMs and ask us why.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by thediehl on Wednesday May 23, 2018 @08:42PM (#17139912)
I started with Unix Shell Programming http://a.co/au9OUrB
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by beokop on Wednesday May 23, 2018 @05:07PM (#17138297)
So much internal tooling at a company can be avoided if you can just get people comfortable with basic *nix programs. No, we don’t need a web interface to show that data. No, we don’t need to code a dropdown to sort it differently.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by digi_owl on Wednesday May 23, 2018 @06:51PM (#17139182)
And yet the UX people, particularly around Linux, wants to bury the _nix cli so damned deep...
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by tormeh on Thursday May 24, 2018 @05:51AM (#17142505)
CLIs have a discoverability problem. Knowing how to use any given one is a skill that takes years to hone. Learning a single command can take up to an hour. Most webapps are more constrained, but a common operation can usually be accomplished by someone who hasn't seen it before in less than 3 minutes.
Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by jonhendry18 on Sunday May 27, 2018 @02:54AM (#17165833)
The 'apropos' command is very handy on machine or OS you aren't familiar with.

If you want to find out what tools are available on the CLI that operate on jpegs, you'd try 'apropos jpeg' and get a list of things that mention jpeg in their man page.

Re:Command-line Tools can be 235x Faster than a Hadoop Clust... by AnIdiotOnTheNet on Wednesday May 23, 2018 @08:50PM (#17139953)
Can't say I blame them. The base concept is sound but the implementation is archaic and obtuse as hell.