Shell Productivity - Part 1

  • jaymcgavren

Oops, a subscription is required to view this video. You can enroll now to watch, or try out all that Code School has to offer with a free two-day Hall Pass.


halolee said

Hi Jay,

Great screen cast, please ignore my comment in the Unix Part 2, I found exactly what I want here.

Totally awesome :D

Dominick Guzzo said

very well presented and with some pretty nifty tricks in there. thanks for sharing!

Thomas James Repetti said

great video! especially the really interesting features of the find exec command. The last segment was kind of lost on me. after signing up for the service, i was a little surprised to see the lack of non-web-development languages and the dominance of ruby. i know these are what envy labs specializes in, but i feel like for writing coreutil-esqe programs, it should be done in bash or lower.

Ryan Dennler said

Very great tutorial, I learned alot from this.

Onezino Gabriel Moreira said

Jaym, you gave us great tips. Can I request a "be productive in vim" screencast?


Jay McGavren said

@julioagh I wasn't able to replicate this, but if the problem continues, file a ticket at and we'll get it looked at. Please be sure to note whether the problem is with the embedded video, or the HD or SD download.

Julio Gonzales Heredia said

The information provided is excellent, but the video freezes at 10:55 and only audio continues.

Matthew Closson said

Jay, nice tips on the find -exec. Now I use this to update multiple .acignore files in this version control system called accurev which requires one .acignore file per subdirectory.

find . -type d -mindepth 1 -exec cp .acignore "{}" \; then I alias that in my ~/.bashrc to acigup. Very nice.

Terry Pensel said

I love this screencast Jay. I find it really helpful for anyone who has to edit/manage/create files which is EVERYONE. The SSH command line history, and record what they have done for problem tickets is especially helpful. We need more on how to do command line editing on previous commands in the bash shell. Jay, Mahalo for making this screencast.

Jeremy McDuffie said

Great screencast. As for removing with the find command, why not just use the -delete flag? For example:

find -name '.DS_Store' -type f -delete


Jay McGavren said

@audioman apologies if I've offended. I really do think many IDEs have unnecessary bloat, but Subversion has helped me out a lot over the years and my comments there were meant to be tongue-in-cheek. Regardless, this is indeed not the forum for religious wars over tools, and people should use what helps them get their jobs done. My goal is to present the tools that help me do mine.

Peter said

Some great tips here. Although, I'd like to see him step off his pedestal while screen casting. Think all IDEs are bloated? Think subversion is archaic? Telling me your unsolicited flame-war opinions makes you sound like a snob, and more importantly, it detracts the viewer from your message.

Marshall Shen said

Great lesson! One suggestion: it might be very useful if we have a pdf of all the commands in the screencast with comments beside them, so that people can review the lesson easily.

Scott Parrish said

less has some useful conditionals for it's prompt too. the general format is: ?X:. for instance ?f%f:stdin. uses the ?f condition (Is there an input filename), displays %f if true and stdin if false. So a slightly fancier version of this same prompt would be: export LESS='-i-P?f%f:stdin. ?m(%i/%m). Line %lb?L/%L(%Pb\%).'

for command: less file1 the prompt is file1 Line 47/174(27%)

for command: less file1 file2 file3 file1 (1/3) Line 17/77(22%)

for command: cat file1 | less stdin Line 47


Jay McGavren said

I'm prepping the sequel for release in a couple weeks, and I want to avoid covering things everyone already knows about...

Here's what I was thinking of covering: diff --recursive; xargs; sort -n; Including date, hostname, etc. in $PS1 prompt; history, including $HISTFILESIZE, !!, !1234, and reverse-search; Sharing a ~/dotfiles repo on GitHub.


Anton Yakimov said

Try to use Gow instead od Cygwin in Windows. And "Console" - nice terminl for same OS.

Elad Kehat said

My productivity just went up a notch. Thanks!

Regarding the cb utility, it uses pbcopy which is only available on osx. On linux I use xsel and alias clip to xsel --clipboard. It has the same effect as your cb.

Javier Murillo said

The Shell is the best friend of a developer. This video it's very cool. Regards from Mexico

Eric Raio said

This was awesome, how to see more screencasts like these. Thanks Jay.

seth said

While this video is great, I have to agree that a course would be awesome.

I'd think a course about choosing search commands and building basic regular expressions would be awesome, and I think you're the perfect one to do it.


Jay McGavren said

Yeah, xargs is good stuff, huh? I find it combines nicely with that "cb" utility I showed, too. I'll make a point of covering it in a future episode, and you're right - it might make find -exec obsolete. I didn't even know about grep -r. Guess this is going to be one of those endeavors where I learn as much as I teach. :)

Yury said

Nice stuff, Jay. Especially thanks for the ack and ruby tweaks. By the way find myproject -exec grep class {} \; can be replaced with more convenient grep -r class myproject

Alex Blakemore said

Take a look at the xargs command. Its much more useful and easier to use than the -exec flag to find. And can handle more complex situations easily. Compare find . -name .svn -print | xargs rm -fr to find . -name .svn -exec rm -fr {} \;


Jay McGavren said

Everyone: thanks for the feedback! @devosvictor Dunno about a course, but I've got additional Code TV episodes planned on this topic...


Jay McGavren said

@asanghi Standard public speaking advice is to "tell them what you're going to tell them", so I do it to help people track the flow of the screencast. Anything can be taken too far, though - I'll look for opportunities to shorten those summaries in the future.

devosvictor said

This is cool ^^ Cant there be a course of this? It would be very helpfull as their arent alot good "how to work in shell" guides on the internet.

Good work!

Aditya Sanghi said

I might be the only one here, but i don't like the amount of time that is spent on "table of contents" type of slides and explaining what we are going to talk about next. it's a screencast and i'd rather they get to the meaty bits quickly.

Justin Herrick said

Great Tips to be found here. Extremely useful. Thanks for working on this Jay


In this episode, Jay McGavren shares some of his favorite tricks for working in the shell. No unreadable sed or awk scripts here. Just simple, solid tips you can use every day, including time savers with find, less, ssh, and command-line Ruby.