Report this

What is the reason for this report?

What are your favorite BASH shortcuts?

Posted on January 2, 2020

As a SysAdmin/DevOps, I spend a lot of my day in the terminal.

Here are my favorite shortcuts!



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
0

Accepted Answer

The below two are particularly useful if you have a very long command.

  • Delete everything from the cursor to the end of the line:
Ctrl + k
  • Delete everything from the cursor to the start of the line:
Ctrl + u
  • Delete one worked backwards from cursor:
Ctrl + w
  • Search your history backwards, this is probably the one that I use the most, it is really handy and speeds up my work-flow a lot:
Ctrl + r
  • Clear the screen, I use this instead of typing the clear command:
Ctrl + l
  • Stops the output to the screen:
Ctrl + s
  • Enable the output to the screen in case that previously stopped by Ctrl + s:
Ctrl + q
  • Terminate the current command
Ctrl + c
  • Throw the current command to background:
Ctrl + z

I use those constantly every day and it saves me a lot of time.

If I’ve missed any feel free to share them in the comments below!

To go back to the [char] character in the current line.

ctrl + alt + ] + [char]

To go forward to the [char] character on the current line.

ctrl + ] + [char]

To swap two char around the cursor position.

ctrl + t

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.