Linux Shell Editing Shortcuts
Tips and Tricks of Power Shell Users
If you want to learn to use the Linux command line, you're going to have to do a lot of typing, and make sure you type everything accurately ... right?
No! One of the secrets power shell users know is that they don't really have to be great typists. They take advantage of the typing shortcuts the shell offers.
You probably know you can erase the last character by hitting the backspace key. But you can correct mistakes in a lot more ways than that.
First trick: Ctrl-U deletes everything back to the beginning of the line. No need to hold the backspace key down and wait while it repeats; a single Ctrl-U is much faster. It's great for when you change your mind about a command or want to clear the line and think about what to do next. Think of U as Undoing the line you were typing.
Next -- and my personal favorite -- is Ctrl-W to erase the last word. Like Ctrl-U, it's a lot faster than holding the backspace key down and waiting. But unlike Ctrl-U, it lets you keep some of what you already typed. Try it -- you'll be amazed how handy it is.
You may have noticed that you can use the left and right arrow keys while you're typing a line in the shell. But Home and End don't work to go to the beginning and end of a line -- how do you do that? The secret: type Ctrl-A to go to the beginning of the line, Ctrl-E to go to the end. To remember those two, think of A as being at the beginning of the alphabet while E just stands for "End".
If you move the cursor back while you're editing a line, with the left arrow or Ctrl-A, you might also be interested in Ctrl-K. It deletes from the cursor position to the end of the line.
Enabling editing shortcuts in other apps
Most of these editing shortcuts will work in lots of other Linux apps besides the shell, though not every program supports all of them. Try them in editors, mail programs, browsers.
In some programs and on some Linux distros, they aren't enabled by default. If you find them useful, you can turn them on for Firefox and any GTK-based applications by setting your Gnome key theme to "Emacs". To do that, either add the line
gtk-key-theme-name = "Emacs"to a file named .gtkrc-2.0 in your home directory, or run this command:
gconftool-2 --set /desktop/gnome/interface/gtk_key_theme Emacs --type string
Solid state disks (SSDs) made a splash in consumer technology, and now the technology has its eyes on the enterprise storage market. Download this eBook to see what SSDs can do for your infrastructure and review the pros and cons of this potentially game-changing storage technology.
- 1Linux Top 3: Linus Lashes out, Linux 3.14 Gets PIE and Ubuntu One is Done.
- 2Linux Top 3: Ubuntu 14.04, Debian Gives Squeeze More Life and Red Hat Goes Atomic
- 3Linux Top 3: CoreOS, Oracle Enterprise Linux 7 and Ubuntu 14.10
- 4Linux Top 3: Debian Dumps SPARC, Ubuntu Takes Over Linux 3.13 and the Core Infrastructure Initiative
- 5Linux Top 3: Fedora, Ubuntu and Gluster Lose Community Leaders