Archive for October 2011
When programmers talk about the timeless books that will always be relevant, certain classics always come up: The Mythical Man Month, Structure and Interpretation of Computer Programs, Design Patterns, Refactoring, Code Complete, and others. Code is never mentioned in that group, and for good reason. This is not a book about programming, and it is not a book about software development.
Nevertheless, it is a book of importance to software developers. Code is a book about how computers are built to understand data and logic, and how the combination of data and logic allows for automation and computation. Read the rest of this entry »
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