Codementor Events

Terminal Hacks Every Developer Should Know

Published Aug 29, 2017
Terminal Hacks Every Developer Should Know

If there is one tool that every developer uses regardless of language, platform, or framework, it’s terminal. Getting better at typing commands into terminal can be a huge productivity boost.

I find the following shortcuts very useful in day-to-day activities.

1. Move to the Front or End of a command

  • Ctrl + e — Moves cursor to the end of the line.
  • Ctrl + a — Moves cursor to the beginning of the line.

2. Searching through previous commands

Every shell implementation has a “history” command that returns a list of previous commands as output. You could then copy, paste, and run it. Shouldn’t there be a smarter way of doing this?

The following commands can help you do this in a much better way.

  • Ctrl + r — Reverse search the history of commands executed.

3. Kill and Yank Operations

  • Ctrl + k — Detes all characters after the cursor.
  • Ctrl + u  — Deletes everything before the cursor from the start of the command line.
  • Ctrl + w  — Deletes the word before the cursor.

4. Common Usages

The typical use-case for Ctrl + w is when you make a spelling mistake while typing something really fast. Rather than doing multiple backspaces, a direct Ctrl + w is a huge savior.

Here's the screen-cast with typical use case for killing the previous word.

You may not need these hacks into your day-to-day operations, but you should aim to always keep them in your 'mind-cache' so you can fetch them when you need them!

Comment below if you know some other cool terminal hacks that can boost productivity!

Discover and read more posts from Priyank Trivedi
get started
post commentsBe the first to share your opinion
Show more replies