HackerTube
HomeLongsLikedHistoryWatch laterCategoriesPlaylistsSettings

The Unix Chainsaw - Gary Bernhardt

timmonta2 HN recommenders · recommended in 2 months, 2016-2022
YouTube
25K views · 11 years ago · talk · evergreen

Gary Bernhardt's Cascadia Ruby Conference 2011 talk on using the Unix shell for practical problem solving. He builds pipelines interactively by iterative refinement, using small tools as levers.

Recommended as a brilliant demonstration of how to think in Unix pipelines.

Testing, debugging & developer toolsOperating systems & kernels#unix#pipelines#commandline#garybernhardt#shellworkflow

5 comments from Hacker News

@btschaegg2022 · in “Ask HN: I’m New to Computer Science and Engineering. Any Advice?”

1.) Be curious. Stay curious. Experiment, play with things. Your time during university is likely the best time for this and it will likely get harder later on when you're on the job and there's much more emphasis on finished work than on learning experiences. Also, I'm quite sure that it will be beneficial for you if you familiarize yourself with different ways of thinking (obviously programming languages, environments and paradigms, but that will likely apply to anything non-technical, as well). I gained this perspective from dealing with people who didn't really do that, but also from knowing that I personally also did this way too late (and from the benefits it brought me nonetheless). If you're only familiar with Windows, try Linux. Try BSD. Try OS X, if you want to. Try working in the terminal. Familiarize yourself with different editors (especially Vim and Emacs, maybe also newer ones like Kakoune). Learn bash, have a look at AWK and sed. Maybe learn Perl. Try out functional programming, logic programming (like Prolog) and so on and so forth. If you're feeling adventurous, play with niche systems like Haiku[1] or TempleOS[2], just to gain new insights on how things could work. Maybe try the ACME editor[3]. [1]: link [2]: link [3]: link Of course, there might be courses that will nudge towards some of those tools. If you visit some of those: Cool! But if there are no such courses (I didn't encounter many of them myself), try to explore these things nonetheless. Ev

CitesView on HN
@pdkl952019 · in “Understanding the fork system call in Unix”

As others have already menti9oned, running 'bc' isn't actually that expensive. Comparing it to Bitcoin is ridiculous. Let's investigate the actual cost of that sum: $ cat foo.sh #!/bin/bash a="1.5" b="0.5" sum="$(echo "${a} + ${b}" | bc)" echo "The sum of ${a} and ${b} is ${sum}" $ /usr/bin/strace -q -D -w -c ./foo.sh The sum of 1.5 and 0.5 is 2.0 % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 55.53 0.001225 123 10 read 9.75 0.000215 215 1 execve 5.53 0.000122 7 18 mmap 4.03 0.000089 8 11 3 open 3.04 0.000067 7 10 mprotect 2.99 0.000066 5 13 rt_sigprocmask 2.54 0.000056 56 1 clone 2.45 0.000054 5 10 close 2.40 0.000053 5 11 rt_sigaction 1.81 0.000040 5 8 fstat 1.41 0.000031 8 4 lseek 1.22 0.000027 5 5 3 stat 0.91 0.000020 20 1 write That was 56us to clone(2) the process and 215us to execve(2) 'bc'. All together just 12.74% of the time spent running syscalls , and an even smaller portion of the total time to launch and execute this simple example. Most of the time is sent launching bash itself at the beginning. Using a language such as python or launching a custom binary will have similar costs to to launch the program. If we're talking about a single persistent process (e.g. an interactive shell), then we're still talking about paying just 0.25ms of CPU time to perform a useful calculation . Compared to intentionally wasting time by design maximizing hash prefix guesses to "mine" Bitcoin "ain't the same fucki

CitesView on HN
@pdkl952019 · in “Problem solving with Unix commands”

Gary Bernhardt[1] gave a great talk about practical problem solving with the unix shell: "The Unix Chainsaw"[2]. "Half-assed is OK when you only need half of an ass." In the talk, he gives several demonstrations a key aspect of why unix pipelines are so practically useful: you build them interactively . A complicated 4 line pipeline started as a single command that was gradually refined into something that actually solves a complicated problem. This talk demonstrates the part that isn't included in the the usual tutorials or "cool 1-line command" lists: the cycle of "Try something. Hit up to get the command back. Make one iterative change and try again." [1] You might know him from his other hilarious talks like "The Birth & Death of JavaScript" or "Wat". [2] ▶ this video

Strongly recommendsView on HN
@pdkl952017 · in “Twice as happy customers means half the marketing spend”

I know I've had a few situations where the "play around with the numbers" part happened first. Usually once the actual goal was known the algebra (or similar details) would be obvious... but sometimes the inefficient/toy implementation was good enough. Sometimes half-assed is ok, if it's the the right half of the ass.[1] The wrong half becomes yet another type of technical debt to be refactored "someday". (this is not an excuse to ignore algebra or blindly assume the easiest/most-fun method is correct/useful/sane) [1] link via ▶ this video

CitesView on HN
@agumonkey2016 · in “Programming blogs”

From the same person: - The unix chainsaw, how to use tiny tools[1] as lever upon themselves. No absurd wit as in wat. Simply brilliant. ▶ this video - Also listed above the wat page, link : boundaries, a whole new world. More abstract wishful thinking. Still brilliant.

Strongly recommendsView on HN
Ruby Conf 12 - Boundaries by Gary Bernhardt45:55

Ruby Conf 12 - Boundaries by Gary Bernhardt

Confreaks
58K views • 13 years ago
"Liberating the Smalltalk lurking in C and Unix" by Stephen Kell40:56

"Liberating the Smalltalk lurking in C and Unix" by Stephen Kell

Strange Loop Conference
25K views • 12 years ago
Bloat: How and Why UNIX Grew Up (and Out) - Rusty Russell,Matt Evans42:39

Bloat: How and Why UNIX Grew Up (and Out) - Rusty Russell,Matt Evans

Linux.conf.au 2012 -- Ballarat, Australia
21K views • 14 years ago
I made an GPT-powered Linux shell that guesses your bash command (and hallucinates crazy stuff)4:41

I made an GPT-powered Linux shell that guesses your bash command (and hallucinates crazy stuff)

River's Educational Channel
39K views • 5 years ago
Linux Kernel Development, Greg Kroah-Hartman - Git Merge 201637:34

Linux Kernel Development, Greg Kroah-Hartman - Git Merge 2016

GitHub
72K views • 9 years ago
Filesystem in Rust - Kent Overstreet35:16

Filesystem in Rust - Kent Overstreet

The Linux Foundation
124K views • 2 years ago
"What UNIX Cost Us" - Benno Rice (LCA 2020)34:14

"What UNIX Cost Us" - Benno Rice (LCA 2020)

linux.conf.au
218K views • 6 years ago
AT&T Archives: The UNIX Operating System27:27

AT&T Archives: The UNIX Operating System

AT&T Tech Channel
2.2M views • 14 years ago
Tech Talk: Linus Torvalds on git1:10:15

Tech Talk: Linus Torvalds on git

Google
4.1M views • 19 years ago
Capsicum: Practical Capabilities for UNIX34:51

Capsicum: Practical Capabilities for UNIX

USENIX
11K views • 16 years ago
Unix and Google7:16

Unix and Google

FOAM
9K views • 10 years ago
Bringing the Unix Philosophy to Big Data by Bryan Cantrill: FutureStack1331:09

Bringing the Unix Philosophy to Big Data by Bryan Cantrill: FutureStack13

New Relic
18K views • 12 years ago
CppCon 2017: Matt Godbolt “What Has My Compiler Done for Me Lately? Unbolting the Compiler's Lid”1:15:46

CppCon 2017: Matt Godbolt “What Has My Compiler Done for Me Lately? Unbolting the Compiler's Lid”

CppCon
178K views • 9 years ago
Stevey's Tech Talk E39 -- A guided tour of Emacs45:11

Stevey's Tech Talk E39 -- A guided tour of Emacs

Steve Yegge
13K views • 4 years ago
Introduction to Git with Scott Chacon of GitHub1:22:12

Introduction to Git with Scott Chacon of GitHub

InfoQ
396K views • 15 years ago
"Tree-sitter - a new parsing system for programming tools" by Max Brunsfeld38:38

"Tree-sitter - a new parsing system for programming tools" by Max Brunsfeld

Strange Loop Conference
63K views • 8 years ago
Two decades of Git: A conversation with creator Linus Torvalds41:50

Two decades of Git: A conversation with creator Linus Torvalds

GitHub
548K views • 1 year ago
CppCon 2019: Matt Godbolt “Compiler Explorer: Behind The Scenes”1:00:21

CppCon 2019: Matt Godbolt “Compiler Explorer: Behind The Scenes”

CppCon
29K views • 7 years ago
Emacs From Scratch #1 - Getting Started with a Basic Usable Configuration58:30

Emacs From Scratch #1 - Getting Started with a Basic Usable Configuration

System Crafters
299K views • 6 years ago
Lexical Scanning in Go - Rob Pike51:18

Lexical Scanning in Go - Rob Pike

GoogleFOSSSydney
162K views • 15 years ago