Bicycle skills
johndcook.com
johndcook.com
vi is something I did take the time to learn, and it's paid off hugely over the last couple of decades.
Definitely. Smarter tab completion and smarter word deletion (Ctrl+W) are probably the two "most used" features for me.
FWIW, after ~6 years using Bash, moving to zsh last week was a revelation. I swapped to tmux (after dabbling in screen) the week prior. Has been a good fortnight.
[1] https://github.com/robbyrussell/oh-my-zsh/ is a great source of zsh plug-ins and configs. I use the "simple" theme and the git, brew and gem plugins (amongst others): https://github.com/elithrar/dotfiles/blob/master/zshrc
Bash[1] deletes to the space. Zsh[2] deletes to the slash. I installed Zsh just now to find this out, and I love that Zsh appears to use ctl-w to delete words like vim does.
[1]: GNU bash, version 4.2.37(2)-release (i686-pc-linux-gnu)
[2]: zsh 5.0.0 (i686-pc-linux-gnu)
$ grep -l abc **/Makefile(mh-1)
If I want to look at the most-recently-modified file, I can $ less *(om[1])
If I have a symlink 'dir' that points to a directory and I want to cd to the pointed-to directory, I can $ cd dir(:A)
Clearly, there are lots of codes, but you don't need to remember them, since the tab-completion gives you online help. I can type the '(' then press 'tab', and it'll give me a list of the various codes that can follow and what they mean.There are tons of others. If I want all
*
EXCEPT *.h
I can use '*~*.h'
Or for instance, say I have a directory of photos. I want to pick DSC00095.jpg through DSC00107.jpg. In bash, you cry; in zsh I say DSC<95-107>.jpg.
After I've typed in the glob, I can press 'tab', and it'll expand the glob in-place, letting me know if the code worked without executing. I can then undo to get the code back and have it live in my history.There are plenty of other non-globbing-related features of zsh that make it worth looking at, but this is one that doesn't get as much press as it deserves.
One of those...is zsh. You just don't need it when you're an Emacs user. You get all the power of Emacs, but you can use it in the inferior shell. No need to remember weird arg registers.
I can see three places you might be coming from and feel that way: you use Eshell; you use ansi-term mode with e.g. bash; or you simply barely ever hit shell, instead using things like dired-interactive to accomplish shell-like tasks.
The last, to me, is a nonstarter. You can do many, many things using native Emacs tools, but not all. dired is not the right tool for quickly making a pile of nested directories and moving files into them based on file size, there is no Emacs take on top, etc. You can come back and say, "Fine, write some elisp for that," but to me, that's like saying you don't need to learn PowerShell because you have Explorer and VBScript. Just because there's overlapping functionality doesn't mean that one tool can substitute for the other.
If you were thinking ansi-term, then learning the nuances of zsh (or fish or whatever) is still helpful. ansi-term, at most, frees you from memorizing keystrokes. Past that, you're still very much using whatever shell you're invoking. I'd want to learn zsh just as much, or as little, running in ansi-term as in Emacs.
That just leaves Eshell. I like Eshell fine, but there are hard limits on what you can do with it as a shell, because it's not really a shell as much as an interactive elisp REPL with an alternative default syntax. Job management and piping are bizarre, you're still thrown into ansi-term for interactive tools (and yes, there are some tools I would prefer to use interactively), even non-interactive stuff sometimes displays incorrectly or bizarrely due to Eshell not really being a term, and so on. So while you can use Eshell most of the time, it's not a complete replacement for a real shell.
Now, is it possible that Emacs tools like dired/VCS integration/etc., combined with Eshell, means you can use a "real" shell less if you want to? Yeah, sure--just like I can use folder actions and AppleScript on my desktop to replace some of my old cron jobs with on-demand drag-and-drop processing. But to say that learning zsh wouldn't be rewarding if I knew Emacs just strikes me as weird.
I use the inferior shell and magit.
On that day I resolved to learn the actual shell.
In programming terms, this would be like taking the time to learn your language so that you can effortlessly interact with it and think about it without really thinking about it. Or learning your editor so you can move around your document on a subconscious level.
I guess if we're going to play with the metaphor, learning to use a bicycle is not sharpening the saw, it's learning to use a new and better tool.
So if we go with editors, learning to type faster is sharpening the saw, just like training to walk faster. But switching to Emacs is like learning to ride a bicycle where you used to run.
If I do go ahead I often end up saying something like this to my coworkers:
People will only pick up bicycle skills where their benefit (or perceived benefit) is greater than the annoyance they deal with.
You can learn Dvorak, even as a professional programmer, if you just reserve half an hour each day on the side for the learning, and keep using your old layout for your day job until you are comfortable.
WRT Vim, I made the switch without too much trouble. In fact, I find the j/k on the left hand and h/l on the right hand useful.
And go install emacs. Its shortcuts are easier to type in dvorak.
For me it's not about speed, but about ergonomics.
Are you sure? I'd consider typing in Dvorak a non-standard skill that would make me less productive with ~99% of keyboards in existence!
This strikes me as about as worthwhile as learning to ride a non-standard dual-wheel vehicle, as a consequence of which it becomes much harder to ride regular bicycles.
I'm an avid fan (and rider) of unicycles and recumbent bikes like the Flevo Racer. The Flevo Racer's pivotal steering makes you have to learn biking again from the ground up. It takes a few afternoons (or faster, if you aren't that clumsy). Riding a unicycle took me two weeks to learn.
Nevertheless, I can still ride a standard upright bike without any problems. And after all this crazy wheeled stuff, even bipedal locomotion still works fine.
Skills don't have to crowd each other out.
Dvorak is more unicycle than bicycle.
[1] http://reason.com/archives/1996/06/01/typing-errors/print
asdf jkl; aoeu htns
Placement of high-frequency letters, especially vowels, reduces finger movement and eases typing. There's no magic about it.
[1] www.typocheck.co.uk/dvorak/
*-- I switched over by trying Dvorak for an hour a day instead of the QWERTY i had used for about 3-4 weeks. I was a below average QWERTY user. Touch typist, but not fast/ not a lot of typing experience.
Colemak = new hotness.
http://www.kaufmann.no/roland/dvorak/
http://news.ycombinator.com/item?id=351059
https://en.wikipedia.org/wiki/Dvorak_Simplified_Keyboard#Pro...
I'm just too lazy to switch from Dvorak to NEO, even though it would make it easier to type German Umlaute. Also my Kinesis Advantage keyboard supports Dvorak out of the box.
Maybe it's because the default black background makes it feel like we're throwing our commands into a "magical pit inside the computer", and waiting for the output, which will be an error unless the commands were perfect. That perspective is unpleasant.
Maybe it would be helpful to visualize a GUI while using the command line, where instead of clicking on a menu or button, you have to type its name.
(having said that, with unix you can be extremly productive and it is (more or less) designed to be easily understood once you grasp some concepts.)
It's very similar to many mainframe interfaces with non-intuitive commands. Many legacy IT departments have these. Questions like "How do I do X?" have answers from experts like "Type XKY= and then hit PF3". But that sequence of steps is nowhere on the current screen's list of commands, or in it's help documentation. You just need to know it.
This is in contrast to a GUI where every single thing you can do (aside from keyboard shortcuts) is visible. I can hit a random button and see what happens. In a CLI, there are too many possible alphanumeric strings to try, so I can't do the same thing.
(This is of course different if the prompt is not blank, and says "Type 'help' for help")
Recent shells have done good efforts to provides some kind of typing and deduction to reduce friction. It's always nice to have a listing of /etc/hosts or ssh known hosts in place. Browsers picked this since the coming of 'smart' url-bars.
I hope one day we would go all-alan-kay on this and simply have a meta-capable system that parse/cache relevant data straight from the source so you don't need to do any extra work to make the system understand a bit your additions.
Yes. Very yes. To the point where, when you say "some people", what you really mean is "most people".
I don't think the problem is "the command line" so much as it is "the Unix command line". You don't see a lot of people having difficulty with text-adventure command lines. You demonstrate HELP and GET LAMP and they're off to the races.
Whereas Unix commands are hard to discover unless you already know their names, have illogical names, have inconsistent behaviors, have poorly designed documentation (every command has 27 options and they're often documented in alphabetical order on man pages, with the obscure corner-case options given equal weight to the most useful ones), require combinatoric thinking (because many options can be used at one time), take invisible actions ("gzip foo" returns no output and modifies a file in your current directory; you need "ls" to see that it did anything), are context-dependent (you need to know what a "working directory" is or you won't get past square one), and often require a working knowledge of pipes and redirection to be useful (and pipes and redirection aren't intuitive skills).
You need to read a book. Nobody has time to read books. Reading books is a bicycle activity.
> get file.txt
YOU PICK UP THE FILE
> inventory
YOU ARE HOLDING:
file.txt
> gzip file.txt
FILE.TXT HAS BEEN COMPRESSED
> inventory
YOU ARE HOLDING:
file.txt (compressed)
> drop file.txt
YOU CAN'T PUT THAT HERE, THERE IS ALREADY A FILE.TXT HERE
> rename file.txt file.txt.gz
FILE.TXT HAS BEEN RENAMED
> drop file.txt.gz
YOU PUT DOWN FILE.TXT.GZ
Obviously not ideal, but at the very least the idea of inventory-as-clipboard would be useful on the command line.OK: you can get file.txt; gzip file.txt; rename file.txt file.txt.gz; drop file.txt.gz. However, it requires a get and a drop to fiddle the inventory, which doesn't seem to do anything (you are still specifying all the filenames each time).
And I don't see a reason to generate a gzipped file of 'the same name' and then do a rename, it seems better for the new name to be an argument to the gzip operation.
All you really want is to send information from file.txt through gzip to file.txt.gz. As in "gzip < file.txt > file.txt.gz" or "cat file.txt | gzip > file.txt.gz".
But it feels like there should be cases where the clipboard/temporary holding area is much more useful than it is here, I just can't think of them?
MPW also allowed you to differentiate between target and command windows very easily, so you could keep your favorite commands handy and have the output funneled to other views.
Not Lighttable, but a lot more useful than man pages in 99% of cases and pretty darn nice.
It's tough.
Edit: I wanted to add a few more comments.
Someone mentioned scriptability, also composability, speed, "multitaskability".
For me personally, not just tasks I do when programming, but almost anything I do on a computer. The graphical display capabilities are merely a way of displaying content for me (PDFs, web-pages, etc.).
Obviously, if you're dealing with graphical content you want a GUI though.
For two different directories,
find all duplicate files that are
both less than 10 minutes old
This was easily accomplished in a few lines of bash, and then scripted, because I knew I'd have to do it again and again.I'm not accomplished with GUI tools, but I'd be interested to know how this would be done via a GUI.
You take this as evidence that it can be done from a GUI?
So, let's go back to your comment. You said:
I still haven't found a tool which
doesn't have an equivalent GUI.
If you want to make me take you seriously, please tell me how you would: Given two directories,
find all duplicate files that are
both less than 10 minutes old
In other words, given directories A and B, find all filenames f such that: $A/$f is less than 10 minutes old
$B/$f is less than 10 minutes old
$A/$f is identical to $B/$f
Now tell me how you would do that every hour for a week.Gigantic enterprise software/infrastructure projects with no integration test automation because it's cheaper/faster to throw on a few temp testers every time there's a release rather than taking a month to put automation on the whole stack. Role reshuffling to make a savings for the business unit quarterly earnings sheet.
I think the other side of the coin to bicycle skills is something akin to technical debt - call it skill debt, say. Something could be done the right way straight away and the skill/process learned earlier, but because of a shortsightedness regarding cost, the cost to learn them actually increases with time until it's simply not possible without starting all over again.
This is something that can affect organisations as a whole, not just individuals, and I think it's something technical and project managers in growing organisations ought to be aware of - get your people, ALL your people, set up with the requisite bicycle skills that benefit everyone.
I learn skills when I want to - not when the job demands it. I actually enjoy learning things, and do it more often than needed, to improve myself you might say but actually just because.
Bash scripting is another bicycle skill I think. The power of automating tasks is obvious but often it's easier to just type stuff in quickly rather than writing a script and let the machine handle the job.
There are probably many many more, but those just popped into my mind right after reading the definition of a bicycle skill.