O'Reilly logo

Linux in a Nutshell, 6th Edition by Robert Love, Stephen Figgins, Ellen Siever, Arnold Robbins

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Line-Edit Mode

Line-edit mode emulates many features of the vi and emacs editors. The history list is treated like a file. When the editor is invoked, you type editing keystrokes to move to the command line you want to execute. You can also change the line before executing it. When you’re ready to issue the command, press the Enter key.

Select an editor with either set -o vi or set -o emacs ; assignment to the VISUAL or EDITOR variables has no effect. Note that vi starts in input mode; to type a vi command, press the Escape key first.

Common editing keystrokes

vi

emacs

Result

k

Ctrl-P

Get previous command.

j

Ctrl-N

Get next command.

/ string

Ctrl-R string

Get previous command containing string.

h

Ctrl-B

Move back one character.

l

Ctrl-F

Move forward one character.

b

ESC-B

Move back one word.

w

ESC-F

Move forward one word.

X

DEL

Delete previous character.

x

Ctrl-D

Delete character under cursor.

dw

ESC-D

Delete word forward.

db

ESC-H

Delete word backward.

xp

Ctrl-R

Transpose two characters.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required