Posts Tagged ‘linux’
Back in August of last year, for one of the first posts on my brand-new blog, I put up the slides from a lunch-time presentation that I gave on find, grep, sed, and awk. I put it up so that it would be available as reference to those that attended the talk, even though the slides weren’t designed for stand-alone use, and slides make a poor Internet reference.
Given the surprising popularity of that post, it seemed reasonable to repackage the information in a format that is more fitting for a blog post.
grep are incredibly powerful. But many never learn a fraction of what they can do. Did you know that
grep can print the surrounding lines? Or that you can search for files based on permissions? Here’s a collection of examples that might expand your notion of what can be done with
I love keyboard shortcuts, and I do my best to incorporate them with every GUI application that I use regularly. I’ve been comparatively negligent in learning keyboard shortcut for the command-line applications, as it seems less advantages. After all, there’s no need to reach for the mouse, what are we hoping to save?
Nevertheless, there are real efficiencies out there, and here are my favorite Bash shortcuts. Read the rest of this entry »
When you want to see the contents of a text file in unix, the first two things to come to mind are
less. I choose
cat when the files are small, but the pagination and navigation in
less makes it the better choice most of the time.
Suppose you find a directory with five files that are unknown to you. Printing the contents of all five is easy enough with
cat and a pipe:
$ ls | xargs cat
But if you have five files, chances are you don’t just want everything scrolling past you. So we try:
$ ls | xargs less
Hmm … when you get to the bottom of
file1.txt we find the message
(END) - Next: file2.txt. What to do?
As always, the answer is in the
:n for next file,
:p for previous file.
Of course, this isn’t only useful when piping input into
less, it also works when specifying multiple arguments:
$ less file1.txt file2.txt file3.txt
Every programmer should read The Little Schemer (pdf) at some point. It doesn’t take long to read, and I hope to provide a review of it soon. For now, I hope to explain how to get started practically with Scheme, as used in this book, since these details are hard to find.