01. Efficient Cursor Movements

Let's learn some shortcuts for quick navigation around the command line.

Type the following sentence out into your command line for practice.

$ hello I am a testing monkey

Moving to the beginning and end of line

We can use the ctrl-key (^) to move our cursor:

^a
To beginning of the line (bol).
^e
To end of line (eol).

Moving a character or word at a time

We can move through either a character or a word at a time.

^f
Forward one character.
^b
Backward one character.
alt+f
Move cursor forward one word.
alt+b
Move cursor backward one word.

Transposing letters or words

Sometimes when we type really fast, we switch letters or words around.

We can fix this with transpose:

^t
Switches the character with the one next to it.
alt+t
transpose the word at the cursor location with the one preceding it.

Try it with these examples here:

$ java helloWordl
$ ls directoryName -l

Changing casing

To convert to lower or uppercase:

alt+l
Convert characters from cursor to end of the word to lowercase.
alt+u
Same as above, but to uppercase.

Deleting characters or words

To delete (or kill) characters or words, use the following:

^d
Delete the character at the cursor location.
^k
Kill the text from the cursor location to eol.
^u
Kill text from the cursor location to bol.
alt+d
Kill text from the cursor location to the end of the current word.

Clearing the terminal window

If the terminal window seems cluttered and we'd like to clear everything, we type:

$ clear 

Or to be more efficient, just hit ^l.

Aching back from coding all day?

Self-Massage Tool

Aching back from coding all day? Try Back Problems

Relieve spasms, tight muscles, trigger points and pressure points with the Body Back Buddy! This trigger point massage is designed to help you self-message any area of your body - especially those that are hard to reach. Keeping your muscles relaxes and out of contraction is importan in helping to reduce pain and prevent muscle injury.

$ Check price
29.9529.95Amazon 4.5 logo(3,443+ reviews)

More Back Problems resources

Take your Linux skills to the next level!

The Linux Command Line

Take your Linux skills to the next level! Try Linux & UNIX

The Linux Command Line takes you from your very first terminal keystrokes to writing full programs in Bash, the most popular Linux shell. Along the way you'll learn the timeless skills handed down by generations of gray-bearded, mouse-shunning gurus: file navigation, environment configuration, command chaining, pattern matching with regular expressions, and more.

$ Check price
39.9539.95Amazon 4.5 logo(274+ reviews)

More Linux & UNIX resources

Ad