Skip to main content

Have you ever wanted to use Terminal with a more fluid style and increase your speed and efficiency? This article was inspired by watching a colleague navigate long lines of command navigation using only the arrow keys. While my pain threshold is high, seeing this during a group presentation was painful. It's time to sharpen your shortcuts for command-line navigation. Improving your understanding of Terminal can significantly boost your productivity as a developer. Knowing the right shortcuts not only saves time but also makes you more efficient. In this article, we’ll cover essential terminal shortcuts that help you navigate and edit commands quickly and easily.

 

Terminal commands

 

Jump to the start or end of the line

When typing a long command, you might need to quickly move the cursor to the beginning or the end of the line. Instead of holding down the arrow keys, use these shortcuts

Command Description
Ctrl + A Jump to the start of the line
Ctrl + E Jump to the end of the line

 

Move by words

To move the cursor word by word, use the following shortcuts

Command Description
Alt + F Move forward one word
Alt + B Move backward one word

 

Delete text efficiently

Deleting text can be done much faster with these shortcuts

Command Description
Ctrl + W Delete the word before the cursor
Ctrl + K Delete from the cursor to the end of the line
Ctrl + U Delete from the cursor to the start of the line
Ctrl + H Delete the character before the cursor
Ctrl + D Delete the character under the cursor

 

Undo and redo changes

You can undo the last change you made with

Command Description
Ctrl + /  Undo the last change

 

Clearing the screen

If your terminal gets cluttered, clear the entire screen with

Command Description
Ctrl + L Clear the screen

 

Managing the command history

Navigating through your command history can save you a lot of time. Use these shortcuts to quickly access previous commands

Command Description
Up Arrow Scroll through previous commands
Down Arrow Scroll through next commands
Ctrl + R Search through command history 
(start typing to search, press Ctrl + R repeatedly to cycle through matches)

 

Transposing and changing case

To transpose characters or change the case, use these shortcuts

Command Description
Ctrl + T Transpose the characters before the cursor
  Change the case of the character under the cursor:
Alt + U    Uppercase
Alt + L    Lowercase
Alt + C    Capitalise

 

Yank and paste

You can cut and paste text within the terminal using these shortcuts

Command Description
Ctrl + K Cut from the cursor to the end of the line (yank)
Ctrl + Y Paste the last yanked text

 

Other useful shortcuts

Here are a few more shortcuts that can come in handy

Command Description
Ctrl + C Abort the current command
Ctrl + Z Suspend the current command
Ctrl + P Move to the start of the previous command
Ctrl + N Move to the start of the next command

 

 

The wrap

Watching a colleague struggle through long lines of code with the arrow keys was a clear reminder of the importance of mastering terminal shortcuts. By sharpening your command-line navigation skills, you can avoid such inefficiencies and make your work much smoother. Learning and using these terminal shortcuts will make you more efficient and effective in your tasks, just as they helped alleviate the frustration of watching that presentation. Practice these shortcuts regularly, and soon they will become second nature.

Related articles