Hack and / - Dr hjkl and Mr Hack
Without diving headfirst into an ancient Linux holy war, let me set the record straight. I am a card-carrying, home-row hugging, Esc-key hammering, vim user. If you love Emacs, JOE, ed, Kate, gedit or the magnifying-glass-and-magnet approach to text-file editing, that's fine, and I'm not here to judge. It's just that for me, once I got over the initial vi(m) learning curve, I started looking for other tools that take the same approach to key bindings. Specifically, I am talking about the h, j, k and l keys and how you can use them to move left, down, up and right, respectively, in a document. What I found was that most of my favorite tools either already had vi-style key bindings or there was a simple way to enable them. Some programs even offered advanced bindings that closely mimic vim in a number of ways. In this column, I highlight some programs that either have vi key bindings or can be made to have them with a few simple steps.
Before I start talking about specific programs, I probably should explain why navigation with hjkl is better than with the arrow keys. It's a dirty secret among vim users that many people just use the arrow keys and backspace to edit their documents. The main reason hjkl navigation is great is that all of those keys are on the home row. In case you never took formal typing, the home row is the asdfghkl row of keys on a qwerty keyboard. If you learn to touch type, you are taught to rest your fingers on this row by default. This means the hjkl keys are within easy reach, but every time you reach for the arrow keys you have to move your right hand off the home row. Now, if you aren't a touch typist, that isn't a big deal. But if you are, it is almost as disruptive as reaching for the mouse. Granted, I know it is awkward at first, but if you are a vim user and touch type at all, it's worth it to force yourself to use hjkl for navigation until it becomes second nature.
In case you are new to vi key bindings, here are some of the main keys that you'll find work similarly in other programs:
h — move left
j — move down
k — move up
l — move right
^ — move to the beginning of a line
$ — move to the end of a line
G — move to the bottom of the document
g — move to the top of the document (gg in vim)
w — move the cursor ahead one word
b — move the cursor behind one word
/ — enter search mode
n — go to the next search result
N — go to the previous search result
A number of standard command-line programs use vi-style navigation out of the box, and the first I want to mention is less. The less program allows you to page through a text file, and if you needed yet another reason to use less instead of more, use it because j and k will move down and up a document. In addition, you can type G to scroll to the very bottom of a document and g (gg in vim) to move to the very top. As with vim, you also can press / to type a search term, and press Enter, then press n and N to find the next and previous matches, respectively. Like with less, by default, you can scroll through man page output with the same keys.
Screen also can use vi key bindings to navigate through its copy mode. Screen is an amazing shell program that allows you to open multiple shell sessions and detach and re-attach to them. If you've started using screen after being used to a regular terminal session, you likely ran into the strange behavior screen exhibits when you press Shift and PgUp and PgDn (or use the scroll bar) to scroll up and down through the output. In screen, if you want to view output that has scrolled past the top of the terminal, simply press Ctrl-A Esc to enter copy mode. Within copy mode, now you can use the arrow keys (shame on you) or hjkl to scroll around the output. As with less, you also can use g and G to scroll to the top and bottom of the output. When you are done scrolling, simply press the q key to exit copy mode.
Even bash itself can be set so that you can navigate the command line in true vi style. In your bash shell, just type set -o vi. Now, keep in mind that once you enable this option, you will have to enter insert mode (press the i key) to insert text just like in vi. And, if you want to use h or l to move the cursor left or right, or w or b to move forward or back a word, you will have to press Esc to leave insert mode. For those of you who tried this and want to undo it, simply press i to enter insert mode, and then type set -o emacs.
Kyle Rankin is a systems architect; and the author of DevOps Troubleshooting, The Official Ubuntu Server Book, Knoppix Hacks, Knoppix Pocket Reference, Linux Multimedia Hacks, and Ubuntu Hacks.
Today’s modular x86 servers are compute-centric, designed as a least common denominator to support a wide range of IT workloads. Those generic, virtualized IT workloads have much different resource optimization requirements than hyperscale and cloud applications. They have resulted in a “one size fits all” enterprise IT architecture that is not optimized for a specific set of IT workloads, and especially not emerging hyperscale workloads, such as web applications, big data, and object storage. In this report, you will learn how shifting the focus from traditional compute-centric IT architectures to an innovative disaggregated fabric-based architecture can optimize and scale your data center.
Sponsored by AMD
Built-in forensics, incident response, and security with Red Hat Enterprise Linux 6
Every security policy provides guidance and requirements for ensuring adequate protection of information and data, as well as high-level technical and administrative security requirements for a system in a given environment. Traditionally, providing security for a system focuses on the confidentiality of the information on it. However, protecting the data integrity and system and data availability is just as important. For example, when processing United States intelligence information, there are three attributes that require protection: confidentiality, integrity, and availability.
Learn more about catching the bad guy in this free white paper.
Sponsored by DLT Solutions
| Making Linux and Android Get Along (It's Not as Hard as It Sounds) | May 16, 2013 |
| Drupal Is a Framework: Why Everyone Needs to Understand This | May 15, 2013 |
| Home, My Backup Data Center | May 13, 2013 |
| Non-Linux FOSS: Seashore | May 10, 2013 |
| Trying to Tame the Tablet | May 08, 2013 |
| Dart: a New Web Programming Experience | May 07, 2013 |
- RSS Feeds
- New Products
- Making Linux and Android Get Along (It's Not as Hard as It Sounds)
- Drupal Is a Framework: Why Everyone Needs to Understand This
- Home, My Backup Data Center
- A Topic for Discussion - Open Source Feature-Richness?
- Dart: a New Web Programming Experience
- What's the tweeting protocol?
- Developer Poll
- May 2013 Issue of Linux Journal: Raspberry Pi
Enter to Win an Adafruit Prototyping Pi Plate Kit for Raspberry Pi

It's Raspberry Pi month at Linux Journal. Each week in May, Adafruit will be giving away a Pi-related prize to a lucky, randomly drawn LJ reader. Winners will be announced weekly.
Fill out the fields below to enter to win this week's prize-- a Prototyping Pi Plate Kit for Raspberry Pi.
Congratulations to our winners so far:
- 5-8-13, Pi Starter Pack: Jack Davis
- 5-15-13, Pi Model B 512MB RAM: Patrick Dunn
- Next winner announced on 5-21-13!
Free Webinar: Linux Backup and Recovery
Most companies incorporate backup procedures for critical data, which can be restored quickly if a loss occurs. However, fewer companies are prepared for catastrophic system failures, in which they lose all data, the entire operating system, applications, settings, patches and more, reducing their system(s) to “bare metal.” After all, before data can be restored to a system, there must be a system to restore it to.
In this one hour webinar, learn how to enhance your existing backup strategies for better disaster recovery preparedness using Storix System Backup Administrator (SBAdmin), a highly flexible bare-metal recovery solution for UNIX and Linux systems.




1 hour 54 min ago
3 hours 12 min ago
3 hours 47 min ago
4 hours 9 min ago
8 hours 57 min ago
9 hours 44 min ago
11 hours 18 min ago
12 hours 55 min ago
14 hours 53 min ago
15 hours 10 min ago