code-quality

Few Keyboard Shortcuts for Terminal

few terminal shortcuts

Few Keyboard Shortcuts for Terminal
  • Up/Down Arrows: The up and down arrows on your keyboard move through your last used commands. So, if you wanted to run the second to last command you ran, just hit the up arrow twice and hit Enter. You can also edit the command before you run it.

  • Ctrl+Left and Ctrl+Right: Hitting Ctrl and the left or right arrow keys jumps between arguments in your command. So, if you had a typo in the middle of the command, you could jump to it quickly with Ctrl and a few taps of the left arrow key.

  • Home and End: The Home and End buttons on your keyboard move your cursor to the beginning and the end of the currently typed command, respectively. This is useful if you’ve, say, typed in a command but realize that there’s a typo in the first word. Instead of holding down the left arrow key, just hit home and correct it.

  • Ctrl+U: This clears the entire line so you can type in a completely new command.

  • Ctrl+K: This deletes the line from the position of the cursor to the end of the line.

  • Ctrl+W: This deletes the word before the cursor only.

  • Ctrl+R: This lets you search your command history for something specific. For example, if you wanted to search for the recent commands that included nano, you would hit Ctrl+R and type nano. It would show your most recent command, and you could use the up and down arrows to cycle through your history of commands using nano in them.

  • Tab: One of everyone’s favorite shortcuts employs Tab to autocomplete a line of text. So, say you wanted to type cd ~/Dropbox/, you could just type cd ~/Dr, hit Tab to autocomplete opbox, and continue on with your day.

About the author

Prakash Poudel Sharma

Engineering Manager · Product Owner · Varicon

Engineering Manager at Varicon, leading the Onboarding squad as Product Owner. Eleven years of building software — first as a programmer, then as a founder, now sharpening the product craft from the inside of a focused team.

Keep reading

More on this

Join the conversation0 comments

What did you take away?

Thoughts, pushback, or a story of your own? Drop a reply below — I read every one.

Comments are powered by Disqus. By posting you agree to theirterms.

0:000:00